android 不用sysv-ipc 的原因

2 views
Skip to first unread message

XingChao Wang

unread,
Nov 5, 2009, 11:19:52 PM11/5/09
to liang...@borqs.com, 盛杲
偶然看到这篇文档:

System V IPCs:

  Bionic intentionally does not provide support for System-V IPCs mechanisms,
  like the ones provided by semget(), shmget(), msgget(). 

Android does not support System V IPCs, i.e. the facilities provided by the
following standard Posix headers:

  <sys/sem.h>   /* SysV semaphores */
  <sys/shm.h>   /* SysV shared memory segments */
  <sys/msg.h>   /* SysV message queues */
  <sys/ipc.h>   /* General IPC definitions */

The reason for this is due to the fact that, by design, they lead to global
kernel resource leakage.

For example, there is no way to automatically release a SysV semaphore
allocated in the kernel when:

- a buggy or malicious process exits
- a non-buggy and non-malicious process crashes or is explicitely killed.

Killing processes automatically to make room for new ones is an
important part of Android's application lifecycle implementation. This means
that, even assuming only non-buggy and non-malicious code, it is very likely
that over time, the kernel global tables used to implement SysV IPCs will fill
up.

At that point, strange failures are likely to occur and prevent programs that
use them to run properly until the next reboot of the system.

与ashmem的性能比较,我分析后再更新.

thanks
--wang xingchao
Reply all
Reply to author
Forward
0 new messages