GithubHelp home page GithubHelp logo

loachfish / binder-for-linux Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hungys/binder-for-linux

0.0 2.0 0.0 341 KB

An experimental project to port Android Binder IPC subsystem to Ubuntu Linux.

Makefile 0.24% C 29.03% Shell 0.15% C++ 65.11% Assembly 5.36% Python 0.10%

binder-for-linux's Introduction

binder-for-linux

binder-for-linux is an experimental project to evaluate the feasibility of porting Android Binder IPC subsystem to Ubuntu Linux.

Environment

  • Ubuntu 14.04.4 LTS
  • Linux Kernel 4.2.0-27
  • gcc 4.9.3

Codebase

  • Binder driver: mainline kernel 4.2.0-27-generic
  • Android Framework version: android-6.0.1_r46

Modifications

  • Make binder & ashmem driver dynamically loadable
    • Modified as a standard loadable kernel module
    • Use kallsyms and a shell script to generate symbol dependencies that are not exposed by kernel (e.g. get_vm_area)
  • Fix compatability issues after replacing Bionic C library with glibc
  • Fix compatibility issues of atomic library
    • Some are changed to use standard C++ atomic library (C++11 and gcc 4.9.3+ are required)
    • cutils/atomic.h is re-implemented with x86 atomic instructions
  • Dependencies to Android log daemon and SELinux library are removed
  • And other small fixes...

Get Started

To compile all from source,

$ ./project.sh makeall

Now you can install kernel modules (binder & ashmem) by,

$ ./project.sh insmod

Then run Service Manager in background,

$ sudo servicemanager/servicemanager &

We also prepared a benchmark program to perform correctness test and performance test,

$ sudo test/binderAddInts -n 100 -p 0   # correctness test with 100 iterations
$ sudo test/binderAddInts -n 10000 -p 4096   # performance test with 4K payload and 10000 iterations

Results

Performance Evaluation

We found an obvious fact that when the payload size is greater than 16K, the transmission latency grows much more rapidly compared with a small payload. After tracing more source code, we inferred that this may be due to the use of the single global lock. The Binder driver heavily uses a global lock to protect the critical sections, this may lead to low utilization in high concurrency situation. Also, during the driver initialization phase, the Binder driver created a bottom half โ€“ workqueue, to handle the release of system resource and buffer. During the benchmark with larger payload and higher iterations (e.g. 10000 per test), the workqueue need to handle the release request more frequently; however, the implementation of release function also need to acquire the global lock, which leads to much lower performance for real data transmission.

binder-for-linux's People

Contributors

hungys avatar

Watchers

Justin avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.