Bionic (software)
≈ 5 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
Bionic is an implementation of the C standard library, developed by Google for its Android operating system. It differs from the GNU C Library (glibc) in being designed for devices with less memory and processor power than a typical Linux system. It is a combination of new code and code from FreeBSD, NetBSD, and OpenBSD released under a BSD license, rather than glibc, which uses the GNU Lesser General Public License. This difference was important in the early days of Android, when static linking was common, and since Bionic has its own application binary interface, it cannot be replaced by a different libc without breaking all existing apps. Bionic is a C library for use with the Linux kernel, and provides libc, libdl, and libm (libpthread functionality is part of libc, not a separate library as on some other systems). This differs from the BSD C libraries that Bionic shares code with, because they require a BSD kernel.
Bionic is an implementation of the C standard library, developed by Google for its Android operating system. It differs from the GNU C Library (glibc) in being designed for devices with less memory and processor power than a typical Linux system. It is a combination of new code and code from FreeBSD, NetBSD, and OpenBSD released under a BSD license, rather than glibc, which uses the GNU Lesser General Public License. This difference was important in the early days of Android, when static linking was common, and since Bionic has its own application binary interface, it cannot be replaced by a different libc without breaking all existing apps. Bionic is a C library for use with the Linux kernel, and provides libc, libdl, and libm (libpthread functionality is part of libc, not a separate library as on some other systems). This differs from the BSD C libraries that Bionic shares code with, because they require a BSD kernel. == Components == Some parts of the libc source, such as stdio, are from the BSDs (mainly OpenBSD), whereas others, such as the pthread implementation, were written from scratch. The dynamic memory allocator implementation has changed over time. Releases predating Lollipop include a single native memory allocator, Doug Lea's dlmalloc. For Lollipop and Marshmallow include two implementations: dlmalloc and jemalloc. jemalloc gives much higher performance than dlmalloc, but at the cost of extra memory required for bookkeeping. Most devices switched to jemalloc but low-memory devices did not switch away from dlmalloc. For Nougat through Android 10, all devices use jemalloc. Low-memory devices use a "svelte" configuration of jemalloc that disables the tcache to nearly match the lower memory overhead of dlmalloc while keeping most of the speed of jemalloc. In Android 11, the memory allocator for most devices was switched to , which sacrifices some of jemalloc's high performance for additional security hardening features. Low-memory devices, however, are still permitted to use jemalloc. Some 64-bit devices, like the Nexus 9, are effectively low-memory devices because of the extra space requirements of 64-bit pointers and hosting of two zygotes. (Zygote is an Android system service that is the parent of all Android application processes. ) The libm source is largely FreeBSD's, but with optimized assembler contributed by the various SoC vendors. The dynamic linker (and libdl) were written from scratch. Bionic doesn't include libthread_db (used by gdbserver), but the NDK does. The Android platform includes a statically linked gdbserver, so that developers can use the latest gdb even on old devices. Since Android dropped gdb support and switched to lldb, this is no longer relevant in subsequent releases. There is no separate libpthread, libresolv, or librt on Android the functionality is all in libc. For libpthread, there is no attempt to optimize for the single-threaded case because apps are in a multi-threaded environment even before the first instruction of third-party code is ever run. The Android platform uses libc++ for the C++ standard library (releases up to and including Lollipop used stlport). The NDK historically offered stlport and GNU libstdc++, but those are not longer included in NDK r18 and later releases. Note that if any native code in an Android app uses C++, all the C++ must use the same STL. The STL is not provided by the Android OS, and must be bundled with each app. ==References== ==External links== Developer home page for Android Android Native Development Kit (NDK) home page Bionic sources (official repository) Bionic notes on eLinux.org
Text derived from https://en.wikipedia.org/w/index.php?oldid=1371638804 under CC BY-SA 4.0; modifications have been made.