Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts...

22
Android – Mobile OS Case study 2

Transcript of Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts...

Page 1: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Android – Mobile OS

Case study 2

Page 2: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6

A. Tanenbaum. Modern Operating Systems. 3rd Edition. ISBN: 0136006639  H. Al-Rayes. Studying Main Differences between Android & Linux Operating Systems. Diyala University.

Android Developer Website. http://developer.android.com

Sources and extra reading

Page 3: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

History of Android Android design principles Android Architecture Memory Management Threads and Scheduling Android File System Security Programming Interface

Topics covered in this session

Page 4: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

- What is android? Linux 2.6 based operating system for mobile devices.

- Open source and released under Apache Licence (Carriers can modify it before distributing).

- Google acquired android in 2005.- Android 1.0 released 2008.- In 2012 Android 4.2 released- Improvements include support for new devices:

- Cameras- Multi core CPU- Barometer- etc

History of Android

Page 5: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Long battery life. Fast boot up. Fast response. Applications (Programming environment?) Security

How do these differ from the needs of a desktop system?

Consider how the above are met by the system design.

Design principles – What is required of a mobile OS?

Page 6: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Battery Touch screen Portable (Mobile CPU) More limited memory Fewer devices

Mobile hardware differences

Page 7: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Android Architecture

Source: http://developer.android.com/about/versions/index.html

Page 8: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Android Architecture

Source: http://developer.android.com/about/versions/index.html

Page 9: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Android Architecture

Source: http://developer.android.com/about/versions/index.html

Page 10: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Android Architecture

Source: http://developer.android.com/about/versions/index.html

Page 11: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Android Architecture

Source: http://developer.android.com/about/versions/index.html

Page 12: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Application life cycle

Page 13: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Android uses it’s own virtual machine to manage application memory.

Dalvik VM allows multiple instances of VM to be running efficiently in parallel.

Memory management

Page 14: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Differences between mobile app cycle and desktop app cycle?

Key principles: Android does not usually kill an app, they keep running even after

you switch, but saves state Task killers? Android kills apps when memory usage too high.

But saves it’s state for quick restart.

Uses Linux’s time sliced scheduling policy based on priority

Process Management

Page 15: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Process Priorities

Split into background and foreground.

What happens if UI thread is starved?

Page 16: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Flash Hard Disk Drives

Random Access ~0.1ms 5-10ms

File fragment impact No Greatly impacted

Total power ½ to 1/3 of HDD Up to 15+ watts

Reliability Reliable Less reliable due to mechanical parts

Write longevity Limited number of writes. Less of a problem

Capacity <=512GB Up to 4TB

Price $1.5 - 2.0 GB $0.10 - 0.20 GB

Disk I/O

Page 17: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

What needs storing? Consider a map application (Lat/long).

Swapping to flash affecting life.

Why not use swapping?

Page 18: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Supports multiple different file systems (based on Linux Kernel).

Usually yaffs2/vfat/ext4, depending on device manufacturer.

Partitions: /boot (Included android kernel) /system (Android GUI and pre-installed applications). – Read only /recovery (Backup) /data (User data) /cache (Frequently accessed data) /misc (Contains misc system settings in form of on/off switches) /sdcard (SD card)

Android File System

Page 19: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Android seeks to be the most secure and usable operating system for mobile platforms by re-purposing traditional operating system security controls to:

Protect user data Protect system resources (including the network) Provide application isolation

To achieve these objectives, Android provides these key security features:

Robust security at the OS level through the Linux kernel Mandatory application sandbox for all applications Secure interprocess communication Application signing Application-defined and user-granted permissions

Security

Page 20: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Assigns .unique user ID (UID) to each android application. Uses UNIX style file permissions due to different UIDs Ensures app A doesn’t read app B’s files. Ensures app A doesn’t exhaust B’s memory Ensures app A doesn’t exhaust B’s CPU usage Ensures app A doesn’t exhaust user Bs devices (GPS, BT) Linux kernel enforces security between applications Stops memory corruption errors causing vulnerabilities. Read only system partition

Security Continued

Page 21: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Use of restricted APIs require application permissions.

Application Signing. Application packages are signed to identify author and prevent tampering. Some windows 7 system files are signed in a similar way.

Security Continued

Page 22: Android – Mobile OS Case study 2. Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: 978-0-470-88920-6 A. Tanenbaum.

Each program runs in it’s own VM. Need to understand an activities lifecycle. Make use of Android SDK Applications programmed in Java, with layouts coded in

XML. Packaged as .apk files for delivery through Android

store. Importance of file size + data usage.

Programming for Android