Download presentation
Presentation is loading. Please wait.
Published byMelvyn Jackson Modified over 8 years ago
1
Android Overview Reference: Embedded Android by Yaghmour
2
2 Android Operating system What is Android? Linux kernel modified Various libries Own C library(BIONIC) Dalvik Virtual Machine "Dalvik Virtual Machine." Application framework
3
3 Android Architecture The modified Linux kernel provides device driver, memory management, process management, as well as networking functionalities. library layer Bionic The library layer is interfaced through Java (which deviates from the traditional Linux design). It is in this layer that the Android specific libc(Bionic) is located.
4
4 Android Architecture contd... surface manager The surface manager handles the user interface (UI) windows. Dalvik Virtual Machine (DVM)core libraries The Android runtime layer holds the Dalvik Virtual Machine (DVM) and the core libraries (such as Java or IO). Most of the functionalities available in Android are provided via the core libraries. The application framework houses the API interface. ● activity manager ● activity manager governs the application life cycle. ● content providers ● content providers enable applications to either access data from other applications or to share their own data. ● resource manager notification manager ● resource manager provides access to non-code resources (such as graphics), while the notification manager enables applications to display custom alerts. user applications On top of the application framework are the built-in, as well as the user applications,
5
5 Linux Kernel and Android Kernel Modifications Power Management: wakelocks Low-Memory Killer Binder Anonymous Shared Memory (ashmem) Alarm Driver Kernel Logger …..
6
6 Power Management: Wakelocks wakeLocks Instead of letting the system be put to sleep at the user action (close the lid on a laptop), Android kernel is made to go to sleep as soon and as often as possible. To keep the system from going to sleep while important processing is being done (or waiting for user’s input), wakeLocks are provided. WakeLocks : Each peripheral's power is controlled through the use of WakeLocks : These locks are requested through the API whenever an application requires one of the managed peripherals to remain powered on. If no wake lock exists which "locks" the device, then it is powered off to conserve battery life..
7
7 Low-Memory Killer Android low-memory killer is an add-on to Linux default OOM (Out-Of-Memory) killer. It can enforce different OOM kill properties for different processes according to the components they are running and configures its own low-memory killer to apply different thresholds for each category of process. Basically, the OOM adjustments now allow the user space to control part of the kernel’s OOM killing policies. The higher adjustment number means that the associated process is a better candidate for being killed if the memory is low.
8
8 Binder Binder is an RPC/IPC mechanism. It provides remote object invocation capabilities on top of a classic OS and allows apps to talk to each other. The app developers don’t actually talk to the binder directly. Instead, the interfaces and stubs generated by the aidl tool are used. Binder driver is a character driver accessible through /dev/binder. It is used to transmit data between the communicating parties. It allows one process to designate itself as the “Content Manager”.
9
9 Anonymous Shared Memory Ashmem is another kind of IPC mechanism. It is similar to POSIX SHM but with different behavior: It uses reference counting to determine when it can destroy memory regions. It can shrink mapped regions if the system is in need of memory Typically, a first process creates a shared memory region using ashmem and use Binder to share the corresponding file descriptor with other processes with which it wishes to share the region.
10
10 Alarm Driver Alarm driver is layered on top of the kernel’s existing Real-Time Clock (RTC) and High-Resolution Timers(HRT) functionalities. By default, the alarm driver uses the kernel’s HRT functionality to provide alarms to its users. However, if the system is ready to suspend itself, it will program the RTC so that the system gets woken up at the appropriate time. So if an application needs a specific alarm, it just uses the alarm driver to be woken up at the appropriate time regardless of whether the system is suspended later.
11
11 Standard C Library "Bionic" - Android has own C library called "Bionic" - This library was designed to have fast execution paths, avoid edge cases and remain simple.Combination of the BSD and Android licenses covering the entire library. Where ever possible, reduction of code space and minimization of complexity are the thumb rule. Support for user level threads: In the GNU C library user level threads are provided by the Native POSIX Thread Library (NPTL). NPTL’s memory and disk space footprints are far too large to be considered practical for a small number of concurrent processes running on Android. So many features are eliminated including process shared mutexes and conditional Where ever possible, reduction of code space and minimization of complexity are the thumb rule. This library is especially suited to operate with the limited CPU and memory available on Android platforms. Furthermore, special security provisions were also made.
12
12 Dalvik Virtual Machine DALVIK VIRTUAL MACHINE Application developers write their program in Java which is compiled into java class files. The code is then translated after compilation into a more compacted "Dex file" that can be run on the Dalvik machine. A tool called dx will convert and repack the class files in a Java.jar file into a single dex file. Dalvik has no just-in-time compiler. The virtual machine itself is optimized to perform well on mobile devices with a slow CPU, limited memory, no operating system swap space and most importantly limited battery power.
13
13 Some Key Concepts Application Components Intents Manifest File Processes and Threads Interprocess Communication and RPC
14
14 Application Components Android applications consist of loosely tied components. Components of one app can invoke other components of other apps. There is no single entry point to an app (no main() ). There are predefined events (intents) that developers can tie their components to, enabling their components to be activated. The configuration is stored in the applications AndroidManifest.xml file. Activities – provides a user interface for user interaction. Activities are managed as a stack. The foreground activity is at the top of the stack. Services– background processes or daemons Broadcast Receivers – interrupt handlers Content Providers – manages shared data between applications
15
15 Intents Intents – are the late-binding mechanisms that allow components to interact. Intents are similar to Unix signals that don’t necessarily have to be predefined or require a specific designated target component or app. The Intent typically notifies the ActivityManagerService about the users intent to launch something. An intent is a message in its simplest form, it has information about the operation to be performed or an event that has happened. For example, an app developer could send an intent for an activity to “view” a web page or PDF document even if the requesting app doesn’t include the capability to do so. Also, an app developer could send a specific intent to trigger a phone call.
16
16 Manifest File Manifest file – is a “main” entry point to an app. It is an XML file i.e. AndroidManest.xml. It informs the system of the app’s components, the capabilities required to run the app, the minimum level of the API required, any hardware requirements, etc. The apps’ components are typically all described statically in this file (except broadcast receivers which can be registered at runtime).
17
17 Processes and Threads Whenever an app’s component is activated, a process will start and house that app’s components. All other components of that app will run within the same process (contained within a single Linux process). Developers should avoid making long blocking operations in standard components and use threads instead. When there are too many processes running to allow for new ones to start, Android OOM handler will get called and will determine which one to kill to make space.
18
18 References Book: Karim Yaghmour, Embedded Android, O'Reilly, 1st Edition, 2013 http://www.differencebetween.net/technology/software-technology/difference-between- android-and-linux/ It has summary about features added to linux kernel for android. http://impact.asu.edu/cse430fa10/poster/Internals%20and%20architecture%20of%20Andr oid.pdf It has pictographical representation of main differences between android and linux OS. http://ranganaths.wordpress.com/2010/07/03/android-kernel-and-linux-kernel/ It provides the details of the differences between android kernel and linux kernel. http://coltf.blogspot.com/p/android-os-processes-and-zygote.html It has description about Android processes and mainly about Zygote process. http://www.vogella.com/tutorials/Android/article.html#tutorial_temperature Android Development - Tutorial
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.