Introduction to Android system architecture and kernel

Source: Internet
Author: User

(from thinkphp)

Android is a Linux-based open-source mobile operating system developed by Google, which includes operating systems, middleware, user interfaces, and applications, and does not have any patent barriers that previously hindered the innovation of the mobile industry and was officially released by Google on November 5, 2007. At the same time, Google has set up an open Mobile alliance, which is comprised of more than 30 technology and wireless applications worldwide, including China Mobile, Motorola, Qualcomm, HTC and T-mobile, and Google through its operators, equipment manufacturers, developers and other In order to form an open ecosystem within the mobile industry through the establishment of a standardized and open mobile phone software platform, it is anticipated that the production and use of embedded handheld mobile devices based on Android systems will be the future trend, The demand for the corresponding software will also grow, so a complete and in-depth analysis of the internal Android system is beneficial for software porting and development based on the Android platform.
1 Android System Platform architecture
For the operating system, must be reasonable design, hierarchical, but also to consider the structure of the entire system to be properly coupled, Android system is based on the Linux kernel, it must also have the characteristics of open source, in order to meet the open source people work together.

In terms of the components of the system, the Android platform architecture includes hardware devices, board support packages, drivers, operating system cores, program runtimes, running frameworks, applications, and so on, and their organic integration and collaboration work together to complete the normal operation of the whole system and the processing of transactions.

According to Google Open source data, the entire system by the Linux kernel, library, Android Runtime, application framework and applications, such as 5 parts, System Architecture 1 is shown.

Referring to Figure 1, the top and bottom parts of the system are composed of the main components described below.
1.1 Linux Kernel
Android based on the Linux 2.6 kernel, but not completely copy the kernel, but the kernel has been part of the deletion and modification, on the basis of the Linux 2.6 kernel, the Android core system to achieve security, memory management, process management, network protocol stack and drive model and other functions, The Linux kernel also acts as an abstraction layer between the hardware and the software stack.
① Hardware Drivers: Complete communication with a variety of hardware, the Linux kernel provides most of the device's drivers, such as displays, cameras, memory, keyboards, wireless networks, audio devices, power supplies and other components.
② system memory Management: Unified encoding management of all available memory, defining a full set of memory positioning, using and recycling strategies.
③ System Process Management: the creation and destruction of kernel management processes, the management of communication between processes, and taking the necessary measures to avoid deadlocks and other content.
④ Network Management System: How wireless network devices work, and the kernel controls how to read cached data from network devices.
1.2 Program Library
Library is an ordered collection of information such as standard programs, subroutines, files, and their directories that are available for use, and Android contains a number of C + + libraries that can be used by different components of the Android system through the application framework, following some core libraries:
Surface Manager: Manages the display subsystem and provides seamless integration of 3D layers to multiple applications;
Media framework: Opencore-based multimedia framework that supports playback and recording of many commonly used audio and video format files, while supporting still image files.
SQLite: A lightweight relational database engine that is available and powerful for all applications.
OpenGL es:3d Graphics library for 3D graphics rendering, the library can be accelerated with 3D hardware.
FreeType: Bitmap (Bitmap) and vector (vectors) font display.
WebKit: Supports Android browser and an embeddable Web view.
sgl:2d Graphics library for 2D graphics rendering.
LibC: A standard C system function library inherited from BSD, which is specifically tailored for embedded Linux-based devices.
1.3 Android Runtime (Android runtime)
The Android runtime consists of two parts: one is the core library and the other is its own virtual machine.

The core library provides most of the functionality of the Java programming language core library. The Dalvik virtual machine, which Google has developed for Android, is more efficient and more complex than Sunjava virtual machines, to better support the Android platform and to have independent copyrights. Each Android application runs in its own process and has a separate Dalvik virtual machine instance, Dalvik the virtual machine executes. Dex's executable, which is optimized for the use of small memory while the virtual machine is based on a register, All classes are compiled by the Java compiler and then converted to. dex format by the appropriate tools in the SDK, which are then executed by the virtual machine.
1.4 Application Framework
The application framework defines all the functional components necessary for an application to run, and the developer can access the API framework used by the core application. The application's architectural design simplifies the reuse of components, and any application can publish its block of functionality, and any other application can use its published block of functionality (which should follow the security restrictions of the framework). Similarly, the reuse mechanism of the application makes it easy for users to replace program components.

Hidden behind each app is a range of services and systems, including:
Activity Manager: Used to manage the application lifecycle and provide common navigation fallback functionality.
Rich and extensible views: can be used to build applications that include lists (Lists), grids (Grids), text boxes
(Text Boxes), buttons (Buttons), and even web browsers that are embeddable.
Content Providers: Enables applications to access data from another application, or to share their own data.
Resource Manager (Resource Manager): Provides access to non-code resources, such as local strings, graphics, and layout files.
Notification Manager (Notification Manager): Enables applications to display customized prompts in the status bar.
The Android program framework shows the principle of "unification" and "Compatibility", and its advantages are summarized as follows:
① any application can publish its function block.
② all apps are equal on the Android platform.
③ all applications and resources are managed separately by category.
④ All programs are in their respective roles.
1.5 Applications
When the Android system is released, it is published with a series of core applications and common programs, such as the usual mobile phone functions, including voice phone, phonebook, SMS, camera, phone set, etc. data applications, including mail tools, calendar, browser, map navigation, etc., and Android Various applications on the market; All applications are written in the Java language.
2 Android Kernel
The Android kernel has been partially modified and added based on the Linux2.6 kernel, and is an enhanced kernel version that provides device drivers to support Android platforms, compare with standard Linux kernels, and analyze the overall and basic structure of the kernel, in addition to modifying some bugs. The following is a preliminary description of the core driver based on Android modification:
2.1 System Process Management
Inter-process communication on the Android platform is based on the binder mechanism, which provides a way for interprocess communication that a process can invoke the functionality provided by another process in the form of a remote procedure call, and then return with the result of execution. Android Binder is based on service and client, there is a ServiceManager daemon manages the system's various services, it is responsible for monitoring whether there are other programs to send the request, if there is a request to respond, Each service is registered in ServiceManager, and the client requesting the service goes to ServiceManager request service.
2.2 Memory Management
Low memory Manager (Killer): More flexible than the Linux standard Oom (out of memory) mechanism, it can kill processes as needed to free the required memory. Anonymous shared Memory (ASHMEM): Provides large chunks of shared memory between processes, while providing a mechanism for the kernel to reclaim and manage this memory. The Android pmem (physical):P mem is used to provide contiguous areas of physical memory to the user space, and DSP and some devices can only work on contiguous physical memory.
2.3 File System Management
The Android platform uses YAFFS2 as the MTD NAND Flash file system, and YAFFS2 is a fast and stable, cross-platform embedded device file system for NAND and NOR flash, compared to other Flash file systems YAFFS2 uses smaller memory to save its running state, so it consumes less memory; YAFFS2 garbage collection is very simple and fast, so it can achieve better performance; The YAFFS2 performance is particularly noticeable on large-capacity NAND flash and is ideal for large-capacity flash storage.
2.4 Clock Management
Android Alarm provides a timer to wake the device from sleep, and it also provides a clock reference that runs even when the device is asleep, Android timed device, which provides timing control for the device, Currently supports vibrator and LED devices.
2.5 Power Management
Android Power Management (PM), a lightweight Android power management driver based on the standard Linux power management system, has done a lot of optimizations for embedded devices.
2.6 USB Management
The Android USB drive is based on the Gaeget framework, and the USB gadget driver is a device driver based on the standard Linux USB gadget driver framework.
2.7 System Log Management
Android Logger, a lightweight log device that captures various logs of the Android system.
3 concluding remarks
Android is an open, Linux kernel-based embedded operating system, will be widely used in a variety of mobile handheld devices, the full use of its powerful network capabilities; Due to the nature of open source, Android does not differentiate between core applications and third-party applications, and can freely absorb new and emerging cutting-edge technologies, while Android offers a wide range of functional libraries and tools that can be used to develop rich applications. This can be expected, based on the Open Mobile Phone Alliance (open handset Alliance) Platform strong technical strength and marketing, Android system in the mobile embedded field of application will be very broad.

Introduction to Android system architecture and kernel

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.