The Android kernel has the same functions as the standard Linux kernel, which mainly implements the functions of memory management, process scheduling, interprocess communication and so on. However, there are differences in file system, interprocess communication, memory management and so on.
1, file system . Most mobile devices are not hard drives but flash as storage media, so the Android kernel adds standard Linux dedicated to Flash file system YAFFS2(yet another Flash file systems). The YAFFS2 is a file system based on the NAND Flash log structure that provides loss balancing and power-down protection , which effectively avoids accidental power outages affecting file system consistency and integrity. YAFFS2 performance is better than the JFFS2(journalling Flash file system version 2, Flash-log filesystem version 2nd) that supports NOR-flash memory.
2, Inter-process communication mechanism . Android adds an inter-process communication mechanism to IPC binders. Binder is responsible for inter-process data exchange through services in the Daemon Service Manager management system. Each process accesses the same piece of shared memory through Binder to achieve the mechanism of data communication. From the application-level perspective, the process accesses the data daemon to obtain the program framework interface for data exchange, invokes and shares data through the interface, and other processes need to interact with the program framework interface to facilitate the programmer to develop applications that require interactive data.
3, memory management . The Android kernel employs a low-memory management strategy that differs from the standard Linux kernel. The Android system uses the LMK(Low memory Killer) mechanism, which processes the process by ranking, grouping, and running out of memory, shutting down the processes at the lowest level of the group, ensuring that the system is stable. At the same time, Android has added a memory-sharing processing mode Ashmem(Anonymous shared memory, anonymous sharing RAM). Through Ashmem, the process can freely share the named memory block anonymously, which is not supported in standard Linux.
Surface Manage The module is responsible for managing the interaction between display and storage, as well as compositing on display of 2D drawings and 3D drawings. The graphics system in Android actually uses the C/S structure, the client side is the application, and the Service side is the Surface Flinger , the Client transmits image data through Binder to surface Flinger on the Server side, and ultimately by surface Flinger synthesized to Frame Buffer , and then display it on the screen.
4, power management . Unlike the standard Linux kernel, Android uses a simpler power management strategy that enables power management by switching screens, switching screen backlighting, switching keyboard backlighting, switching button backlighting, and adjusting screen brightness, without realizing Hibernate and standby function. Currently three ways to determine the power management strategy: RPC call , battery status change and power settings . The system contacts other modules by broadcasting Intent or by invoking the API directly. The power management policy also has an automatic shutdown mechanism, which shuts down automatically when power is below the minimum acceptable level. In addition, the Android power Management module automatically adjusts the screen brightness based on user behavior.
5, Drive and other . Compared to the standard kernel, the Android kernel also adds a character output device , an image display device , a keyboard input device , aRTC device , aUSB Devices and other related devices drive, adding a log system that allows applications to access log messages, giving developers greater freedom.
"References"
"Best Practices for Android and PHP development" version 2nd
Android System kernel Layer (Linux Kernel)