Android Neural Networks API —— 一种神经网络软件系统中间层的设计与实现
随着深度学习的进一步发展，用于减轻框架层和硬件厂商开发代价的「中间层表示」以各种形式涌现：包括采用编译技术做图优化的、制定模型文件格式的、操作系统中间层的。本文重点介绍了操作系统中间层的代表 Android Neural Networks API 的软件架构、内部模块交互方式，并讨论了其设计。总体而言，Android Neural Networks API 简洁有效，符合软件系统的设计方法学。
NativeBridge - Manage Java Native Interface Functionality of Alternative Architecture on Android
Android, the most popular mobile operating system, hosts applications composed by Java code and native code. Java Virtual Machine of Android provides Java Native Interface functionality as the bridge of Java world and native world. As native world is platform dependent, it requires significant effort for application vendors to enable ARM applications, which are of the majority in Android ecosystem, on Non-ARM devices. Thus, Android is bind to ARM platform though it's a modern operating system. To address this issue, Android introduced NativeBridge to manage the Java Native Interface functionality of alternative architecture, such that a platform can support non-native applications on it. In this way, Android applications can run on any Android platforms regardless of the architecture.
基于命名空间的动态链接—— 隔离 Android 中应用程序和系统的本地库
Android 提供针对 Java 的 SDK 和针对本地应用的 NDK 作为 API 。对于私有接口，Java 库通过 Java 类加载器 （ClassLoader） 对应用程序隐藏，而本地共享库库可以很容易地被访问。另一方面，Oreo 的 Project Treble 旨在通过将 Android 实现分为Framework 和 Vendor 两个部分来解决碎片化的生态系统。这种代码划分需要在一个进程中分别管理两个本机库的集合。面对这些挑战，Android 动态链接器引入了 命名空间 （namespace）来隔离动态链接空间。 Android 系统部署 命名空间 以防止应用程序与私有本地库动态链接，并在不同的沙箱中管理 Framework 和 Vendor 库。本文分析了Android Oreo 的 命名空间 ，包括动态链接器的机制以及它与高层策略的相互配合，并讨论了其影响和收益。
Namespace based Dynamic Linking - Isolating Native Library of Application and System in Android
Android provides Software Development Kit (SDK, for Java) and Native Development Kit (NDK, for native language such as C and C++) as public Application Programming Interface (API, includes libraries). For private interface, Java libraries are hidden from applications by Java ClassLoader, while native libraries could easily be accessed previously. On the other hand, Project Treble of Android Oreo, aiming to address fragmented ecosystem by dividing Android implementation into Framework and Vendor part, needs to manage native libraries of two sets in one process separately. With these challenges, Android dynamic linker introduces namespace which isolates dynamic linking space. Android system deploys namespace to prevent applications from dynamically linking against private native libraries, and host Framework and Vendor libraries in different sandboxes. This article analyzes the namespace of Android Oreo, including the mechanism of dynamic linker as well as its inter-cooperation with system level namespace policy, and discusses the impacts and benefits.
Android Dynamic Linker in Marshmallow
Dynamic linker, links shared libraries together to be able to run, has been a fundamental mechanism in modern operating system and rich software ecosystem over the past decades. Dynamic linker is always highly platform-customized since it's coupled with binary format of a system. This article introduces the basic conception of dynamic linker and takes Android (Marshmallow) dynamic linker as example to discuss the implementation. We will see that dynamic link is a engineering-purpose mechanism rather than a theory-born one.