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

Post on 23-Dec-2015

248 views 2 download

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

Android – Mobile OS

Case study 2

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

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

Topics covered in this session

- 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

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?

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

Mobile hardware differences

Android Architecture

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

Android Architecture

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

Android Architecture

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

Android Architecture

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

Android Architecture

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

Application life cycle

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

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

Process Priorities

Split into background and foreground.

What happens if UI thread is starved?

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

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

Swapping to flash affecting life.

Why not use swapping?

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

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

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

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

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