Relationship between Android and Linux

Source: Internet
Author: User

Android technology insider-system volume Chapter 2

Relationship between Android and Linux

I. Why does Android choose Linux?

There are many mature operating systems, but why does Android choose to use the Linux kernel? This is related to some Linux features, such:

1. Powerful memory management and process management solutions

2. Permission-based security mode

3. Support for shared libraries

4. Certified Driver Model

5. Linux is an open-source project.

For more information about the above features, refer to the official documentation of the Linux 2.6 kernel, which makes it easier for us to better understand the unique features of Android later. Next, we will analyze the relationship between Android and Linux.

2. Android is not Linux

We may be confused when we see this title. Didn't we always say that android is based on the Linux kernel? Why is it not Linux now? It is also normal to be confused. First, let's take a look at the following points. Then we will analyze each point. After reading this, you will feel that android is not Linux.

Because it does not have a local window system, does not support glibc, and does not include a complete set of standard Linux user programs, and enhances Linux to support its unique driver.

1. It does not have a local Window System

What is a local window system? The local window system refers to the X Window System on GNU/Linux, or the Mac Z of MAC ox X. Windows systems of different operating systems may be different. Android does not use X Windows of Linux, which is not a basic reason for Android.

2. It does not support glibc

Because Android was initially used on some portable mobile devices, Android does not use glibc as the C library for efficiency and other reasons, instead, Google developed a set of bionic libc to replace glibc.

3. It does not include a complete set of standard Linux applications

Android does not completely copy the kernel of the liunx system. In addition to fixing some of the liunx bugs, It also adds a lot of content, such as the gold-fish PLATFORM added based on the ARM architecture, and the yaffs2 FLASH file system.

4. Android proprietary drivers

In addition to the above differences, Android also enhances the Linux Device Driver, mainly as follows.

1) Android binder is a Driver Based on the openbinder framework. It is used to provide Interprocess Communication and IPC functions on the Android platform. The source code is in drivers/staging/Android/binder. C.

2) Android Power Management (PM) is a lightweight Android power management Driver Based on the standard Linux power management system, which has been optimized for embedded devices. Source code is located:

Kernel/power/earlysuspend. c

Kernel/power/consoleearlysuspend. c

Kernel/power/fbearlysuspend. c

Kernel/power/wakelock. c

Kernel/power/userwakelock. c

3) The low Memory Manager (low memory killer) is more flexible than the standard out of memory mechanism in Linux. It can kill processes as needed to release the required memory. The source code is located
Drivers/staging/Android/lowmemorykiller. C.

4) The anonymous shared memory (ashmem) provides a large shared memory among processes, and also provides a mechanism for the kernel to reclaim and manage the memory. The source code is located in mm/ashmem. C.

5) Android pmem (physical) pmem is used to provide continuous physical memory areas to the user space. The DSP and some devices can only work on continuous physical memory. The source code is in drivers/MISC/pmem. C.

6) Android logger is a lightweight Logging Device used to capture various logs of the Android system. The source code is in drivers/staging/Android/logger. C.

7) android alarm provides a timer to wake up a device from its sleep state. It also provides a clock benchmark that runs even when the device is sleeping. The source code is in drivers/RTC/alarm. C.

8) the USB Gadget driver is a device driver based on the standard Linux USB Gadget driver framework. The Android USB driver is based on the gaeget framework. The source code is in drivers/USB/gadget /.

9) in order to provide debugging functions, Android Ram console allows you to write debugging log information to a device called ram console, which is a ram-based buffer. The source code is in drivers/staging/Android/ram_console.c.

10) Android timed device provides the device timing control function. Currently, vibrator and LED devices are supported. The source code is in drivers/staging/Android/timed_output.c (timed_gpio.c ).

11) The yaffs2 File System Android uses yaffs2 as the mtd nand flash file system. The source code is located in the FS/yaffs2/directory. Yaffs2 is a fast and stable cross-platform embedded device file system for NAND and nor flash. Compared with other flash file systems, yaffs2 can use smaller memory to save its running status, therefore, it occupies a small amount of memory. The garbage collection of yaffs2 is very simple and fast, so it can show better performance. Yaffs2 has outstanding performance in large-capacity NAND Flash and is very suitable for large-capacity flash storage.

The above points indicate that android is not Linux. The main content of this book will be centered on the unique parts of Android. Our explanations will be as easy as possible, but we recommend that you first review the basic knowledge of the Linux kernel. Before learning, let's take a general look at the changes made to the Linux kernel in Android, which need to be adjusted during porting.

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.