Cider: Native Execution of iOS Apps on Android
ASPLOS 2014
Jason Nieh
Professor of Computer Science at Columbia University
- A Measurement Study of Google Play (SIGMETRICS 2014)
- KVM/ARM: The Design and Implementation of the Linux ARM Hypervisor (ASPLOS 2014)
- Cells: A Virtual Mobile Smartphone Architecture (SOSP 2011 Best Paper)
- THINC: A Virtual Display Architecture for Thin-Client Computing (SOSP 2005)
Overview
- Introduction
- Overview of Android and iOS
- Architecture
- iOS subsystem on Android
- Evaluation
- Conclusion
Introduction
Users view
Android users cannot access the rich multimedia content available in Apple iTunes.
iOS users cannot easily access Flash-based Web content.
Developers view
Have to develop apps for multiple platforms.
Companies view
Hard to promote new platforms because of lack huge app base of existing platforms.
Virtual Machine
Virtual machines (VMs) are useful to run apps intended for one platform on a different platform.
Problems:
Mobile devices are more resource constrained.
Mobile devices are tightly integrated with standardised interfaces such as GPU.
Cider
An OS compatibility architecture that can simultaneously run apps written and compiled for different mobile ecosystems.
Implement a prototype to run iOS apps on Android.
Concepts
- domestic binary: developed for a given device's OS
- foreign apps: apps for other platforms
- persona: an execution mode assigned to each thread
Overview of Android and iOS
Android & iOS architecture
Android
- Linux kernel
- Apps compiled to Dalvik bytecode, runs in a seperate Dalvik VM instance
iOS
- XNU kernel, a hybrid combination of BSD and Mach
- Apps compiled to native binaries in an extended Mach-O format
Architecture
System Integration
- Emulate the FS
- User-level services: launchd, configd, notifyd
- A proxy service: CiderPress
Difference
- different binary format
- different syscall interfaces
- extensive use of OS services not available on Linux, such as Mach IPC
Techniques
- Kernel ABI
- Duct Tape
- Diplomatic Functions
Kernel ABI
- build a Mach-O binary loader
- a translation layer for async signal delivery
Duct Tape
- Reimplement is time-consuming and error-prone, different kernels have completely different APIs and data structures
- Duct Tape: a compile-time code adaptation layer that supports cross-kernel compilation
- Translate foreign kernel API such as synchronization, memory allocation, process control and list management.
Duct Tape (cont.)
- Three zones: domestic, foreign, duct tape
- Use duct tape to build three subsystems:
- pthread
- Mach IPC
- Apple's I/O kit
Diplomatic Functions
- ioctl passes driver-specific request code and a pointer to memory
- behaviour is driver-specific
- cannot simply implement kernel-level support for foreign, closed libraries which directly manipulate hardware through proprietary interfaces
Diplomatic Functions (cont.)
- save arguments on stack
- set_persona syscall invoked from foreign thread
- restore arguments from stack
- run the domestic function
- save return value on stack
- set_persona syscall to change to foreign persona
- continue to run foreign code
iOS subsystems on Android
Devices
- cross-compile Apple I/O Kit framework
- expose device to I/O kit using a small hook in the Linux device_add function
Input
- Get input from CiderPress and send the Mach IPC to the foreign thread
Graphics
- Replace Graphics call into Native OpenGL call
Evaluation
Setup
- Nexus 7
- 1.3 GHz quad-core NVIDIA Tegra 3 CPU, 1GB RAM, 7" 1280x800
- iPad mini
- 1 GHz dual-core A5 CPU, 512MB RAM, 7.9" 1024x768
- lmbench
- PassMark
Get iOS Apps
- Only accessible on App Store
- re-package to .ipa file to install on Android
Micro Benchmark
- CPU operations
- signal handling
- process creation
- IO
lower is better
Application Benchmark
higher is better
Conclusion
- First system to run iOS app on non-Apple devices
- Innovations:
- Duct Tape
- Diplomatic Functions
Cider
By Jiajun Wang
Cider
Native Execution of iOS Apps on Android
- 186