现在是Linux 3.3的merge window,android的kernel code终于被merge到mainline中了,记得这个问题在一年前就开始讨论android与mainline kernel的分化问题,毕竟android是桌面Linux使用最广泛的distribution版本,把android code merge到mainline中对Linux长期的发展也有好处,当然Google也不希望自己的kernel与mainline kernel越来越远(那样Google的kernel tree维护者会整天merge code,很繁琐)。

现在merge进的subsystem有:

ashmem:Anonymous Shared Memory Subsystem

config ASHMEM        bool "Enable the Anonymous Shared Memory Subsystem"        default n        depends on SHMEM || TINY_SHMEM        help          The ashmem subsystem is a new shared memory allocator, similar to          POSIX SHM but with different behavior and sporting a simpler          file-based API.

从ashmem代码中可以看出,ashmem的后台仍是通用的share memory

binder:Android Binder IPC Driver

config ANDROID_BINDER_IPC        bool "Android Binder IPC Driver"        default n

Binder在android中非常重要,基本上所有的跨进程通信(service间通信)都是用的binder机制。binder本质上是一种IPC,和fifo,msgqueue,shm一样运行在kernel空间。palm使用的也是openbinder。另一种mobile平台使用的IPC机制是DBUS,DBUS比binder更为人熟知,一般Fedora的机器都安装了dbus,而且时时运行着。

[root@localhost ipc]# ps aux|grep bus

dbus 1835 0.0 0.1 11212 716 ? Ssl Jan03 0:02 dbus-daemon --system

root 26552 0.0 0.1 4260 672 pts/1 S+ 05:00 0:00 grep bus

logger:Android log driver

这个subsystem很简单,就是在/dev目录下创建了四个文件:

#define LOGGER_LOG_RADIO        "log_radio"     /* radio-related messages */#define LOGGER_LOG_EVENTS       "log_events"    /* system/hardware events */#define LOGGER_LOG_SYSTEM       "log_system"    /* system/framework messages */#define LOGGER_LOG_MAIN         "log_main"      /* everything else */

和syslog的7个等级差不多,android的logger实现也很简单,log放在ringbuffer中,ringbuffer的默认大小是256K

lowmemorykiller:

config ANDROID_LOW_MEMORY_KILLER        bool "Android Low Memory Killer"        default N        ---help---          Register processes to be killed when memory is low

lowmemorykiller是android中常用的的特性,iphone中也有相同的机制,当内存不够时系统会杀掉一些进程,我以前一直以为android用的是Linux mm的oom_killer,后来想一想应该不是,用Linux mm的oom_killer杀掉进程时系统应该反应已经非常迟钝了,注重用户响应速度的android不会等到那时才杀进程。

lowmemorykiller的实现原理很简单(200LOC),向mm注册一个shrinker,当系统memory压力比较大时,kswapd会调用shrinker清理内存,用户可以配置一些memory threshold来控制lowmemorykiller的行为。

pmem,ram_console,timed_gpio,timed_output,swich这几个subsystem牵涉到硬件层次比较多,暂未深入了解。

Linux在3.3 merge window中还merge了GNU的mpilib库:

config MPILIB

        tristate "Multiprecision maths library"        help          Multiprecision maths library from GnuPG.          It is used to implement RSA digital signature verification,          which is used by IMA/EVM digital signature extension.config MPILIB_EXTRA        bool "Multiprecision maths library - additional sources"        depends on MPILIB        help          Multiprecision maths library from GnuPG.          It is used to implement RSA digital signature verification,          which is used by IMA/EVM digital signature extension.          This code in unnecessary for RSA digital signature verification,          and can be compiled if needed.config DIGSIG        tristate "In-kernel signature checker"        depends on KEYS        select MPILIB        help          Digital signature verification. Currently only RSA is supported.          Implementation is done using GnuPG MPI library

更多相关文章

  1. Android中对Handle机制的理解
  2. Android(安卓)笔试/面试,常见问题整理
  3. Android(安卓)Activity概述
  4. Android(安卓)Binder
  5. Android(安卓)进阶之 Android消息机制Handler
  6. Android进程与线程基本知识
  7. Android深入浅出系列课程---Lesson3 AAF110427_进程生命周期Proc
  8. Android(安卓)入门篇
  9. Android进程so注入Hook java方法

随机推荐

  1. Android沉浸式状态栏小结
  2. Android抓取CSDN首页极客头条内容--网页
  3. android 多通知 参数问题, PendingIntent:
  4. 使用android传感器自己编写温度计,湿度计
  5. Android(安卓)studio git环境配置及提交
  6. 【Android(安卓)C#开发】Xamarin环境搭建
  7. 越过用户授权使用浮窗
  8. android 唯一识别码笔记
  9. android私有文件夹的访问
  10. Activity和Fragment之间的数据通信