简体   繁体   中英

Why android introduce binder in linux kernel?

I'm trying to learn into android (linux) kernel, and I know that android needs very fast (zero-copy) IPC, but still, I don't get the reason why binder needs to be there.

Can the same thing done with unix socket + mmap /dev/shm file?

Let's say using dbus, but to achieve zero-copy, create and open file in tmpfs (eg /dev/shm) delete it (so another process can accidentally open it), send file descriptor to other process and mmap it.

EDIT: instead of create file in tmpfs, you can use shm_open too

Because back then in the mid 2000s, there was no reliable standardised fast in-kernel IPC in Linux. The traditional SysV IPC was mostly deprecated due to its age and fell out of use. So Android developers made their own simplistic yet powerful implementation. On the desktop side, it wasn't until years later than D-BUS became widespread enough but it is still not efficient enough to be utilised in low powered embedded devices.

A Binder implementation was already mainlined into the Linux 3.19 kernel in early 2015. There were plans to move DBUS into the kernel (aka KDBUS and later BUS1) but that never materialised to due to some drama and disagreements between certain Linux kernel developers/maintainers.

Binder is here to stay because it is already part of modern Linux.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM