distributed systems – exercises · platform internals hardware linux kernel memory management...

26
Distributed Systems – Pratical Exercises 1 | Distributed Systems – HS 2015 Leyna Sadamori Leyna Sadamori [email protected] Distributed Systems – Exercises

Upload: others

Post on 07-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 1 | Distributed Systems – HS 2015 Leyna Sadamori

Leyna Sadamori [email protected]

Distributed Systems – Exercises

Page 2: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 2 | Distributed Systems – HS 2015 Leyna Sadamori

§  Programming exercises §  Three assignments §  One open project

§  Theoretical exercises §  Exam preparation for Part 1 (Mattern) §  Exercises for Part 2 (Wattenhofer)

VS Exercises

Page 3: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 3 | Distributed Systems – HS 2015 Leyna Sadamori

§  Maximum achievable points:

§  Points from pratical part (marked by *) can be carried

forward from last year

Grading

Written exam 180 points Assignments 1–3 * 30 points Project * 15 points Total 225 points

Page 4: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 4 | Distributed Systems – HS 2015 Leyna Sadamori

Mobile Platform for Distributed Systems

Page 5: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 5 | Distributed Systems – HS 2015 Leyna Sadamori

Platform Internals

Hardware

Linux Kernel

Memory Management

Process Management

Network Stack

I/O Display Keypad

Touchscreen

Power Management

Other Drivers WiFi, Bluetooth, Camera, Audio, Telephony, Flash,

Sensors

Dalvik Virtual Machine

Android Application A

Dalvik Virtual Machine

Android Application B

Dalvik Virtual Machine

Android Application C

Security

Linux User A

Linux User B

Linux User C

Page 6: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 6 | Distributed Systems – HS 2015 Leyna Sadamori

Java vs. Android

Java App Android App

Program Logic

Java Libraries (common)

Java User Interface

Java-Specific Libraries

Android User Interface

Android-Specific Libraries

App Management

Page 7: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 7 | Distributed Systems – HS 2015 Leyna Sadamori

Android Key Terms

§  «Activity» §  Logical unit of a user activity

(like window in a computer program) §  Usually full-screen

§  «View» §  Hierarchical UI element §  Combined in layouts and

extended to Widgets with more functionality

§  «Service» §  Background activity without UI, e.g., music player or FTP server

Page 8: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 8 | Distributed Systems – HS 2015 Leyna Sadamori

Android Key Terms

§  «Intent» §  Asynchronous message to bind components §  Starts or switches between «Activities» §  Intent Filters are used to only act on specific Intents

§  «BroadcastReceiver» §  Listens for global events (Intents)

e.g., «headphones were plugged» sent by system §  Can be used to pass system events for further processing §  Can inform the user about system events

Page 9: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 9 | Distributed Systems – HS 2015 Leyna Sadamori

Activity Lifecycle

§  Multi-Tasking §  OS keeps apps alive

as long as possible §  On memory shortage,

processes are killed according to their priority

§  States of an Activity §  Running (resumed) §  Paused §  Stopped §  Finished/killed

Page 10: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 10 | Distributed Systems – HS 2015 Leyna Sadamori

Build Tools

Page 11: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 11 | Distributed Systems – HS 2015 Leyna Sadamori

Android Build Process in a Nutshell

Source Code

Compile .apk

Android Package

Package

Java Bytecode

.java .class

Compile

Dalvik Bytecode

.dex

3rd Party Libraries Resources

Compiled Resources

R.java

.xml Compile

Compile

IDE

Page 12: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 12 | Distributed Systems – HS 2015 Leyna Sadamori

§  SDK Tools §  Development and debug tools, emulator, etc.

§  SDK Platforms §  APIs for target platforms

§  SDK Build Tools §  Support libraries

§  Libraries to support backward compatibility

§  All available at different revisions §  Use same major revisions for compile-sdk, build tools and support

libraries

Android SDK Components

Page 13: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 13 | Distributed Systems – HS 2015 Leyna Sadamori

Programming Exercises

Page 14: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 14 | Distributed Systems – HS 2015 Leyna Sadamori

Team

Mihai Bâce Leyna Sadamori Marian George Anwar Hithnawi

Page 15: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 15 | Distributed Systems – HS 2015 Leyna Sadamori

Organization

§  Teams of three §  Development with emulator §  Testing on actual phone

§  Smart phones §  Use your own Android – no rooting required §  Nexus 5 with Android 4.4.3 available by us

§  Grading §  Per group

Page 16: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 16 | Distributed Systems – HS 2015 Leyna Sadamori

Schedule

§  A1: GUI, sensors and Bluetooth Low Energy §  28 Sep 2015 – 09 Oct 2015 (1.5 weeks)

§  A2: HTTP, REST, Web Services §  09 Oct 2015 – 19 Oct 2015 (1.5 weeks)

§  A3: Group communication and logical time §  19 Oct 2015 – 30 Oct 2015 (1.5 weeks)

§  A4: Project (with presentation) §  02 Nov 2015 – 18 Dec 2015 (6.5 weeks)

Page 17: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 17 | Distributed Systems – HS 2015 Leyna Sadamori

Homework

Page 18: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 18 | Distributed Systems – HS 2015 Leyna Sadamori

Create Groups

§  Log in to submission system §  https://www.vs.inf.ethz.ch/edu/vs/submissions/

§  First „exercise“ is to register a group §  Leader starts a group §  Add partners §  Specify which phone you will be using

§  Own Android §  Lecture phone (Nexus 5)

Page 19: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 19 | Distributed Systems – HS 2015 Leyna Sadamori

Submission System

§  Deliverables are submitted via the submission system §  Only team leader can submit files §  Team members must sign the submission to accept submission §  Repeat signature procedure for every new upload

§  Registration „exercise“ §  Submit an empty file (0 bytes) register.txt §  Sign this submission

Page 20: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 20 | Distributed Systems – HS 2015 Leyna Sadamori

Get a phone if necessary

§  A number of Nexus 5 are available §  Reset of device is recommended §  Android 4.4.2 pre-installed §  For the BLE task, you have to update to 4.4.3! §  Pick-up today, after 1 p.m. in CNB H 108

§  Activate debugging

§  «Settings > About phone > Build number» – Tab several times §  «Settings > Developer options > Android debugging»

Page 21: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 21 | Distributed Systems – HS 2015 Leyna Sadamori

Install the Toolchain

§  Java SE JDK §  http://www.oracle.com/technetwork/java/javase/downloads/index.html

§  Android SDK and Android Studio §  http://developer.android.com/sdk/index.html

§  Use Android SDK Manger to get at least §  Android 6.0 (API Level 23) SDK Platform §  Android SDK Build Tools Rev. 23.0.0 §  Android 4.3.1 (API Level 18) x86 System Image

§  Device driver §  Android Composite ADB Interface §  Google for your OS / device combination

§  E.g. for Google phones (windows only) §  http://developer.android.com/sdk/win-usb.html

Page 22: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 22 | Distributed Systems – HS 2015 Leyna Sadamori

Test Your Toolchain

§  Create an AVD in the «Android Virtual Device Manager» §  Device: Nexus 5 §  Target: Android 4.3 - API Level 18 §  CPU: x86 §  Emulator Options: Host GPU

§  Run Sample Application §  Import an Android code sample §  Pick the BasicNetworking sample project

§  Run the project as Android application §  On the AVD §  On your phone

Page 23: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 23 | Distributed Systems – HS 2015 Leyna Sadamori

Android Tutorial

§  Monday, 28 September 2015 §  Introduction to Android programming §  «Live-Hacking» together with you

à Be prepared!

§  Monday, 28 September 2015 §  Assignment 1

Page 24: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 24 | Distributed Systems – HS 2015 Leyna Sadamori

Teamwork

Page 25: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 25 | Distributed Systems – HS 2015 Leyna Sadamori

Escalataion strategies

Team

Teaching Assistants

Main Assistant

Assignment Lecture

CC @team

CC @team

Page 26: Distributed Systems – Exercises · Platform Internals Hardware Linux Kernel Memory Management Process Management Network Stack I/O Display Keypad Touchscreen Power Management Other

Distributed Systems – Pratical Exercises 26 | Distributed Systems – HS 2015 Leyna Sadamori

Online Help

§  You’ll find a lot of resources in the Internet

§  For general introductions, you can start here: §  http://developer.android.com/guide/index.html

§  For specific problems à Google §  Forums, e.g., stackoverflow.com §  Be careful with online resources. Always look at context!