Tuesday, January 26, 2016

Android Platform Architecture

Android is more of a complete software stack for mobile devices than an
operating system. It is a combination of tools and technologies that are carefully
optimized for mobile needs.
Android relies on the well-proven Linux kernel in order to provide its operating
system functions. For the user-space application, Android relies on the Java
Virtual Machine technology by employing the Dalvik virtual machine. The
Android Zygote application process, through service preloading and resource
sharing, boosts the application startup times and allows efficient use of scarce
memory resources on mobile platforms. All these successful technologies play
an important role in the success of the Android platform, as illustrated in Figure

         1-2. In addition to these tools and technologies, the Android runtime provides a
unique computing environment that is tailored for providing a smooth mobile
experience to end users, while streamlining mobile application development for
developers.


Hardware Abstraction Layer
Android relies on the Linux kernel as its hardware abstraction layer (HAL), and
also to provide its operating system functionality. During the course of Android
development, multiple improvements have been made to the Linux kernel code
in order to tune it for mobile needs. The following are the most notable features:
 Alarm timer
 Paranoid network security
 Binder
 Wakelocks
 Android shared memory (Ashmem)
 Process shared memory (Pmem)
 Low memory killer (Viking Killer)
 Logger
Although application developers are not expected to interact with these low-
level components directly, knowing their roles in the overall Android platform is
important.
           Alarm Timer
Android is designed to run on mobile platforms, where the only power to the
device is provided through batteries. Android goes into a variety of sleep modes
in order to efficiently use the limited battery resources. While the device is in
sleep mode, the applications need a way to wake up the system in order to
perform certain periodic tasks. On Android, this is achieved through the alarm
timer kernel module. It allows a user-space application to schedule itself to run
at some point in the future, regardless to the state of the device.
The android.app.AlarmManager class in Android runtime allows the user-level
application to interact with the alarm timer through API calls. The Alarm
Manager allows the applications to schedule an intent using the alarm timer
(intents are discussed in the next chapter). When the alarm goes off, the
scheduled intent is broadcast by the system to start the application. The Alarm
Manager holds a CPU wakelock (described a little later in this chapter) as long
as the application is busy executing code in its broadcast receiver’s onReceive
method. This guarantees that the device will not go into sleep mode again until
the application is finished performing its task.

The alarm timer retains the scheduled alarms while the device is asleep;
however, this list is cleared if the device is turned off and rebooted.
Paranoid Network Security
Network security is one of the most important requirements of any mobile
platform. In order to provide an extensive level of security, Android handles this
requirement at the lowest possible layer as a kernel modification. Through this
implementation, Android restricts access by the group of the calling process.
Applications should request the necessary permissions in advance, in order to
be part of these network groups. Otherwise, the network access of these
applications will be blocked within the kernel.

     Binder
The Android platform architecture makes heavy use of interprocess
communication (IPC). Applications communicate with the system, phone
services, and each other by using IPC.
NOTE: Interprocess communication (IPC) is a mechanism to allow applications to
exchange data with each other and also with the operating system itself.
Although Android relies on the Linux kernel for its operating system-related
functionality, it does not use the System V IPC mechanism that is provided
through the Linux kernel. Instead, it relies on an Android-specific IPC system,
which known as Binder.
Binder technology originated with the engineers at Be Inc. as a part of the Be
Operating System (BeOS). The development of Binder continued at PalmSource
as a key foundation of the Cobalt system, and later was open sourced as a
Linux kernel module under the name OpenBinder project. Android’s Binder
implementation is a complete rewrite of the OpenBinder project in order to
comply with the Apache License. Binder communicate between processes
using a kernel module.






No comments:

Post a Comment