SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
Copyright 2016 ITRI 工業技術研究院 0
Android-in-cloud, a combination of
android-x86 open source project and
Linux container technology
COSCUP 2018
工業技術研究院
資料中心系統軟體組
吳天健 (tcwu2005@gmail.com)
1Copyright 2018 ITRI 工業技術研究院
講者自介
With over 15 years of experience in
developing assembly, firmware, embedded
software and video encoding algorithm on
variants of CPUs including x86, Arm, and
proprietary processor.
I joined ITRI Cloud Computing center of
Mobile Application (CCMA) as a system
software engineer in 2014. And I've been
working on the project "Cloud Execution
Platform for Android Containers” since
2016.
My research interest includes Hypervisor,
Containerization, and Linux kernel.
2Copyright 2018 ITRI 工業技術研究院
回顧
❖ We were speakers of
COSCUP 2017
• https://youtu.be/9W_ZMyany-
0?t=42m27s
❖ In January, 2018, ITRI ICL
released the virtual
smartphone implementation
as “CLONDROID” open
source project on github.
The project enables one
Google Pixel XL handset to
run multiple tailored Android
containers on it.
Android Container on
Google Pixel
https://github.com/clondroid
3Copyright 2018 ITRI 工業技術研究院
Clondroid: Multiple Your Mobile Phone
Linux Kernel + LXC + Drivers
Virtual Devices namespace-aware binder
Shared service invocation
Unshared service invocation
Linux Kernel + LXC + Drivers
Surface Flinger buffer
Host Android
Shared Framework
Services
Surface Flinger
Window Manager
Android n
Window Manager
A container-based virtual
smartphone open source project
initiated by ITRI
You are welcome to visit
https://github.com/clondroid/cba
-aosp-marlin-7
4Copyright 2018 ITRI 工業技術研究院
Clondroid
Display Switching between Containers
• Layers of different Android
containers in SurfaceFlinger
• SurfaceFlinger groups layers
according to their container
ID
Assign layers of host container to
layersSortedByZ of primary display
primary display
compose
Assign layers of container 1 to
layersSortedByZ of primary display
primary display
compose
5Copyright 2018 ITRI 工業技術研究院
App Streaming in Gaming Industry
6Copyright 2018 ITRI 工業技術研究院
The Needs for App Streaming Cloud
Infrastructure
❖ Virtual Android in The Cloud Enables
➢ VMI as a better solution for the BYOD
➢ Mobile cloud-based Gaming-on-Demand services
➢ Cloud gaming bot - online 24/7
❖ A Case Study - Redfinger Cloud Phone
➢ 5 million subscribers in 2016
➢ Services and Charge
• $9.95 USD / per month for 8 GB Storage, 4 GB RAM
❖ Flexible and Cost Effective Infrastructure
Is The Key
7Copyright 2018 ITRI 工業技術研究院
LXC meets Android
❖ To host Android VMs in cloud
➢ Hypervisor
➢ Emulator
➢ LXC + Android
❖ LXC
➢ LXC (Linux Container) = Linux namespace + Cgroup
❖ Android and Its Software Stack Comprises
❖ To containerize Android for cloud, it covers
➢ Linux system
➢ Complete Android-namespaces that Linux namespaces
does not
➢ Relative cloud system design
(LXC介紹摘錄自wiki)
目前的LXC使用下列內核功能來控制行程:
• 內核命名空間(行程間通訊(IPC)、
uts、mount、pid、network和user)
• AppArmor和SELinux配置
• Seccomp策略
• chroot(使用pivot_root)
• Kernel Capibilities
• 控制組(cgroups)
因此,LXC通常被認為介於「加強版」的
chroot和完全成熟的虛擬機器之間的技術。
LXC的目標是建立一個儘可能與標準安裝的
Linux相同但又不需要分離內核的環境。
8Copyright 2018 ITRI 工業技術研究院
Linux vs Android in Software Stack
• The Android operating system
has its own C library (為了輕薄
短小)called Bionic whereas
Linux systems use GNU C
library.
• Android owns its specific
kernel driver, Binder (see
kernel/drivers/staging/android/)
這個目錄還有其他的如lmk,ashmem,alarm
• Application execution model
(i.e. Dalvik VM)
• Rootfs (Android’s startup
script beginning from init.rc)
Source, Aug7,2018 from http://svholla.net/conndots.html
9Copyright 2018 ITRI 工業技術研究院
Why BINDER is crucial in Android?
• The existing model is called
Android native code
• The new one, 依賴BINDER的
Server-client model
• Applications and Services may run in
separate processes but must communicate
and share data.
IPC的花費鉅大
• The solution is binder driver to facilitate inter-
process communication (IPC)
• BINDER not only provide software
service
• Starting in Android O, the Android framework
and HALs now communicate with each other
using binder
參考1, Studying Main Differences between Android & Linux Operating Systems Hadeel Tariq Al-Rayes M.Sc. Computer Science Basic
Education College-Computer Science Department Diyala University
參考2,The Device Driver Structure for Android with Linux Kernel Driver and Android HAL, William W.-Y. Liang (梁文耀),
10Copyright 2018 ITRI 工業技術研究院
Binder Namespace
❖ Device Namespace
➢ Laadan and his colleagues at Cellrox have put together a set of patches
based on the 3.4 kernel for the Android emulator (goldfish)
➢ https://github.com/Cellrox/devns-
patches/blob/master/dev_ns__adopt_the_android_binder_driver
❖ Google’s Android binder patch
➢ https://lkml.org/lkml/2016/10/24/339. (patch)
➢ https://sourceforge.net/p/android-x86/kernel/ci/kernel-
4.4/tree/drivers/android/. (directory)
Device namespaces, https://lwn.net/Articles/564854/,LWN ,Jake Edge, August 28, 2013
From Martijn Coenen <>
Subject [PATCH 06/10] android: binder: support multiple /dev instances.
Date Mon, 24 Oct 2016 15:20:34 +0200
share
Add a new module parameter 'devices', that can be
used to specify the names of the binder device
nodes we want to populate in /dev.
11Copyright 2018 ITRI 工業技術研究院
Android Device (HAL)
❖ Android HAL Architecture
Linux Device Drivers
The new comer:
Android HAL
參考, The key issues for teaching or learning Android and Linux Kernel 梁文耀, CTO 和沛移動股份有限公司
12Copyright 2018 ITRI 工業技術研究院
Android Device Virtualization
❖ Device/HALs
➢ Audio
➢ Bluetooth
➢ GPS
➢ Camera
➢ Sensors
➢ Ethernet
➢ Backlight
➢ …族繁不及備載…
 Why Android-x86 is a good
baseline of Android
Containerization
• Sensor example
https://sourceforge.net/p/android-
x86/hardware_libsensors/ci/nougat-
x86/tree/
❖Audio Device Emulation
• https://github.com/SVMP/android_de
vice_mitre_svmp/tree/svmp-
2.x/libaudio
13Copyright 2018 ITRI 工業技術研究院
Container1
App App App
Android Framework
Surface
flinger
Windows
Manager
Service
Manager
Input
Manager
Container2
App App App
Android Framework
Surface
flinger
Windows
Manager
Service
Manager
Input
Manager
Container3
App App App
Android Framework
Surface
flinger
Windows
Manager
Service
Manager
Input
Manager
Android as Host
LXCTools
namespaces
Graphic Driver Binder Driver
Keyboard Driver
Mouse Driver
Touch-Panel
Other
Device Drivers
Display
Virtualization
Binder (IPC)
Virtualization
Input
Virtualization
…...
Device
Emulati
on
…...
Device
Emulati
on
…...
Device
Emulati
on
❖ Android-in-cloud DEMO
➢ https://youtu.be/UkxE0e7m1D4
❖ Android-in-cloud software stacks
Android-in-cloud
14Copyright 2018 ITRI 工業技術研究院
Android scheduling
❖ Android’s foreground/background process
scheduling
14
/dev/cpuctl/tasks
/dev/cpuctl/bg_non_interactive/tasks
cpu.shares=1024
cpu.shares=50
ActiveManager
jni/android_util_
process.cpp
libcutils/sched_
policy.c
How set_sched_policy() is called
15Copyright 2018 ITRI 工業技術研究院
❖ Senario
➢ cpu.shares
• specifies a relative share of CPU time available to the tasks in a cgroup
➢ Android assigns system services to bg_non_interactive group
➢ In order to maintain fame rate @ specific level, Android assigns
@ least 5% of CPU resources to bg_non_interactive group
❖ Symptom
➢ As the # of containers increases, App UI update
frequency is not stable
❖ Reason
➢
16ms
UI Update (ms/per frame)
2 containers
system service process cpu.share
s
Host
only
system_server, com.android.systemui 5%
+ con1 system_server, com.android.systemui
system_server, com.android.systemui
5%
+ con2 system_server, com.android.systemui
system_server, com.android.systemui
system_server, com.android.systemui
5%
But there are other Androids…
16Copyright 2018 ITRI 工業技術研究院
Container-aware Scheduler
❖ Solutions
➢ Improve schedule policy, make it to
understand there are containers
➢ Assign separated subgroup and
shares value to each android
container
16ms
before
UI Update (ms/per frame), 2 containers
after
system service process cpu.shares
Host
only
system_server,
com.android.systemui
5%
+ con1 system_server,
com.android.systemui
system_server,
com.android.systemui
10%
+ con2 system_server,
com.android.systemui
system_server,
com.android.systemui
system_server,
com.android.systemui
15% DEMO@
https://youtu.be/e7
FpZojOj5c
17Copyright 2018 ITRI 工業技術研究院
Network topology design in
container-based cloud
❖ Linux bridge , a pure
software switch
❖ A simple block of script to
enable Linux bridge
br0
eth0 veth1 veth2
Android Container 1
eth0
Android Container 2
eth0
DHCP
Server
SVMP
Server
Firewall
LAN
Linux Bridge
FOUND=`grep br0 /proc/net/dev`
if [ -n "$FOUND" ] ; then
echo "br0 exists, skip"
else
brctl addbr br0
ifconfig eth0 0.0.0.0
brctl addif br0 eth0
dhcptool br0
fi
18Copyright 2018 ITRI 工業技術研究院
Pitfalls of Linux bridge
❖ You don’t need to enable IP forwarding
❖ Unexpected bridge netfilter behavior
❖ Be sure in promiscuous mode
### NOT NECESSARY TO ENABLE ROUTING ###
###echo 1 > /proc/sys/net/ipv4/ip_forward
### IF THERE IS BRIDGE NETFILTER, DISABLE THEM
###
for f in /proc/sys/net/bridge/bridge-nf-* ; do echo 0 >$f ; done
make sure promiscuous mode enables
● in hypervisor, check network setting
● in physical machine
For promiscuous mode, IFF_PROMISC, 0x100 should be set.
$ cat /sys/devices/virtual/net/veth0/flags
0x1303 # 0001 001[1] 0000 0011 # device is in promiscuous mode.
$ cat /sys/devices/virtual/net/br0/flags
0x1003 # 0001 000[0] 0000 0011 # device is not in promiscuous mode.
19Copyright 2018 ITRI 工業技術研究院
GetMAC()
{
if [ -n "$1" ]; then
##OID="02:16:3e"
OID_PREFIX="02"
OID_SUFIX=$(cat /sys/class/net/peth0/address | md5sum | sed
's/(..)(..).*/1:2/')
OID="$OID_PREFIX:$OID_SUFIX"
echo OID=$OID
RAND=$(echo $1 | md5sum | sed 's/(..)(..)(..).*/1:2:3/')
echo "$OID:$RAND"
else
echo "ERROR: please supply hostname to create MAC address from, e.g.:"
echo " $FUNCNAME myhost"
fi
}
Mac address assignment
In a container-based cloud, mac addresses of each container
should be
 Pre-assigned
 Lower address (br0 automatically take away new enslaved nic card’s
mac address if it’s lower)
 Manageable (設想你有上百甚至上千個容器要管理,要生成,指派,出錯的時
候大略判定mac所屬的區段)
tcwu2005@itri-29:~$ GetMAC con1
02:9f:8b:8e:52:8e
tcwu2005@itri-29:~$ GetMAC con2
02:9f:8b:17:52:5b
tcwu2005@itri-29:~$ GetMAC con3
02:9f:8b:37:1b:c9
20Copyright 2018 ITRI 工業技術研究院
X86 Server GPU Test
container# avg.fps sum.fps
1 60 60
5 60 300
10 34.6 346
15 24.2 363
20 18.5 370
30 13.97 419
• Hardware: rack mount server MI1200
• GPU: Intel embedded core ‘gt4e’, 2/3 of
area 210-220mm2 is for gpu
• In each container , run test app ‘seascape’ ,
a small size (4MB) GPU benchmark with
highly realistic dynamic ocean render using
OpenGL ES 2.0 and specific glsl shader
features
0
20
40
60
80
0 10 20 30 40
avg.fps
0
50
100
150
200
250
300
350
400
450
0 5 10 15 20 25 30 35
sum.fps
1. Container numbers of 1 and 5 , average fps is 60
and no more than that, guess it’s fixed to system
(system fps = 1/vsynv_period)
2. More benchmark applications executed
simultaneously, the total bandwidth of gpu
reaches around four hundreds of frames per
second
21Copyright 2018 ITRI 工業技術研究院
ITRI OPEN SOURCE PROJECTS
❖ Cuju: An Open Source
Project for QEMU/KVM
based Fault Tolerance
❖ CLONDROID: A Container
based Virtual Smartphone
Open Source Project to allow
you to run multiple Android-OS
on single Google Pixel XL.
Separate work and personal data
easily.
https://github.com/clondroid
22Copyright 2018 ITRI 工業技術研究院
工研院 (ITRI) COSCUP 2018 徵才活動
# 徵才ing
❖ 工研院資通所目前正在尋求具有以下
經驗跟能力的人才:
- 系統安全
- 軟體安全
- 虛擬化系統
- Container (LXC)
- IaaS / PaaS / SaaS
- Android 作業系統
- 軟體定義式儲存系統
- 快閃記憶體磁碟陣列系統
- 深度學習
- DevOps
- UI / UX engineering
- I/O 虛擬化
- CEPH Software Storage Platform
❖ 請留下您的聯絡方式,並告訴我們您
有興趣的職缺。
# We are hiring!
❖ We are ITRI Information and
Communication Labs (ICL). We need
people who have the following
talents:
- System security
- Software security
- Virtualization
- Container (LXC)
- IaaS / PaaS / SaaS
- Android operating system
- Software-defined storage
- All flash array
- Deep learning
- DevOps
- UI / UX engineering
- I/O virtualization
- CEPH Software Storage Platform
23Copyright 2018 ITRI 工業技術研究院
Container-Based-Android Team
Members
Tzi-cker Chiueh,
General Director of ICL/ITRI
Victor Hsu Tian-Jian Wu Te-Yu Tsai I-Fan WangIan TsaiSting Cheng

Más contenido relacionado

La actualidad más candente

Secure development on Kubernetes by Andreas Falk
Secure development on Kubernetes by Andreas FalkSecure development on Kubernetes by Andreas Falk
Secure development on Kubernetes by Andreas Falk
SBA Research
 

La actualidad más candente (20)

Usernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root userUsernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root user
 
ISC HPCW talks
ISC HPCW talksISC HPCW talks
ISC HPCW talks
 
[KubeConEU] Building images efficiently and securely on Kubernetes with BuildKit
[KubeConEU] Building images efficiently and securely on Kubernetes with BuildKit[KubeConEU] Building images efficiently and securely on Kubernetes with BuildKit
[KubeConEU] Building images efficiently and securely on Kubernetes with BuildKit
 
TSN apps running on VxWorks RTOS as a KVM guest at the intelligent edge
TSN apps running on VxWorks RTOS as a KVM guest at the intelligent edgeTSN apps running on VxWorks RTOS as a KVM guest at the intelligent edge
TSN apps running on VxWorks RTOS as a KVM guest at the intelligent edge
 
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動するStargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
 
【CNDO2021】Calicoのデプロイをミスって本番クラスタを壊しそうになった話
【CNDO2021】Calicoのデプロイをミスって本番クラスタを壊しそうになった話【CNDO2021】Calicoのデプロイをミスって本番クラスタを壊しそうになった話
【CNDO2021】Calicoのデプロイをミスって本番クラスタを壊しそうになった話
 
Startup Containers in Lightning Speed with Lazy Image Distribution
Startup Containers in Lightning Speed with Lazy Image DistributionStartup Containers in Lightning Speed with Lazy Image Distribution
Startup Containers in Lightning Speed with Lazy Image Distribution
 
Comparing Next-Generation Container Image Building Tools
 Comparing Next-Generation Container Image Building Tools Comparing Next-Generation Container Image Building Tools
Comparing Next-Generation Container Image Building Tools
 
IAU workshop 2018 day one
IAU workshop 2018 day oneIAU workshop 2018 day one
IAU workshop 2018 day one
 
Secure development on Kubernetes by Andreas Falk
Secure development on Kubernetes by Andreas FalkSecure development on Kubernetes by Andreas Falk
Secure development on Kubernetes by Andreas Falk
 
OpenShift 4, the smarter Kubernetes platform
OpenShift 4, the smarter Kubernetes platformOpenShift 4, the smarter Kubernetes platform
OpenShift 4, the smarter Kubernetes platform
 
Cross-compilation native sous android
Cross-compilation native sous androidCross-compilation native sous android
Cross-compilation native sous android
 
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
The overview of lazypull with containerd Remote Snapshotter & Stargz SnapshotterThe overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
 
[KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
 [KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui... [KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
[KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
 
How to cross compile ROS2 distro by taken VxWorks RTOS as an example
How to cross compile ROS2 distro by taken VxWorks RTOS as an exampleHow to cross compile ROS2 distro by taken VxWorks RTOS as an example
How to cross compile ROS2 distro by taken VxWorks RTOS as an example
 
OpenShift Commons Briefing: Ask Me Anything about Cinder and Glance
OpenShift Commons Briefing: Ask Me Anything about Cinder and GlanceOpenShift Commons Briefing: Ask Me Anything about Cinder and Glance
OpenShift Commons Briefing: Ask Me Anything about Cinder and Glance
 
[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1[JOI] TOTVS Developers Joinville - Java #1
[JOI] TOTVS Developers Joinville - Java #1
 
Build and Run Containers With Lazy Pulling - Adoption status of containerd St...
Build and Run Containers With Lazy Pulling - Adoption status of containerd St...Build and Run Containers With Lazy Pulling - Adoption status of containerd St...
Build and Run Containers With Lazy Pulling - Adoption status of containerd St...
 
容器與IoT端點應用
容器與IoT端點應用容器與IoT端點應用
容器與IoT端點應用
 
Kernel Recipes 2019 - Driving the industry toward upstream first
Kernel Recipes 2019 - Driving the industry toward upstream firstKernel Recipes 2019 - Driving the industry toward upstream first
Kernel Recipes 2019 - Driving the industry toward upstream first
 

Similar a Coscup2018 itri android-in-cloud

Revolutionizing the cloud with container virtualization
Revolutionizing the cloud with container virtualizationRevolutionizing the cloud with container virtualization
Revolutionizing the cloud with container virtualization
WSO2
 
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
Edge AI and Vision Alliance
 
Evolution of Linux Containerization
Evolution of Linux Containerization Evolution of Linux Containerization
Evolution of Linux Containerization
WSO2
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
QAware GmbH
 
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre..."APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
Edge AI and Vision Alliance
 

Similar a Coscup2018 itri android-in-cloud (20)

Container based android
Container based androidContainer based android
Container based android
 
“Khronos Standard APIs for Accelerating Vision and Inferencing,” a Presentati...
“Khronos Standard APIs for Accelerating Vision and Inferencing,” a Presentati...“Khronos Standard APIs for Accelerating Vision and Inferencing,” a Presentati...
“Khronos Standard APIs for Accelerating Vision and Inferencing,” a Presentati...
 
Moby Open Source Summit North America 2017
Moby Open Source Summit North America 2017Moby Open Source Summit North America 2017
Moby Open Source Summit North America 2017
 
Oscon 2017: Build your own container-based system with the Moby project
Oscon 2017: Build your own container-based system with the Moby projectOscon 2017: Build your own container-based system with the Moby project
Oscon 2017: Build your own container-based system with the Moby project
 
Revolutionizing the cloud with container virtualization
Revolutionizing the cloud with container virtualizationRevolutionizing the cloud with container virtualization
Revolutionizing the cloud with container virtualization
 
OpenShift 4 installation
OpenShift 4 installationOpenShift 4 installation
OpenShift 4 installation
 
Red Hat and kubernetes: awesome stuff coming your way
Red Hat and kubernetes:  awesome stuff coming your wayRed Hat and kubernetes:  awesome stuff coming your way
Red Hat and kubernetes: awesome stuff coming your way
 
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
“Khronos Group Standards: Powering the Future of Embedded Vision,” a Presenta...
 
Neo4J with Docker and Azure - GraphConnect 2015
Neo4J with Docker and Azure - GraphConnect 2015Neo4J with Docker and Azure - GraphConnect 2015
Neo4J with Docker and Azure - GraphConnect 2015
 
Evolution of Linux Containerization
Evolution of Linux Containerization Evolution of Linux Containerization
Evolution of Linux Containerization
 
Evoluation of Linux Container Virtualization
Evoluation of Linux Container VirtualizationEvoluation of Linux Container Virtualization
Evoluation of Linux Container Virtualization
 
Slide DevSecOps Microservices
Slide DevSecOps Microservices Slide DevSecOps Microservices
Slide DevSecOps Microservices
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
 
Docker Platform and Ecosystem Nov 2015
Docker Platform and Ecosystem Nov 2015Docker Platform and Ecosystem Nov 2015
Docker Platform and Ecosystem Nov 2015
 
AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...
AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...
AWS Summit Singapore 2019 | Latest Trends for Cloud-Native Application Develo...
 
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdf
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdfOpenShift_Installation_Deep_Dive_Robert_Bohne.pdf
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdf
 
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
 
Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...
 
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre..."APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
"APIs for Accelerating Vision and Inferencing: Options and Trade-offs," a Pre...
 
Kata Container - The Security of VM and The Speed of Container | Yuntong Jin
Kata Container - The Security of VM and The Speed of Container | Yuntong Jin	Kata Container - The Security of VM and The Speed of Container | Yuntong Jin
Kata Container - The Security of VM and The Speed of Container | Yuntong Jin
 

Último

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 

Último (20)

OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 

Coscup2018 itri android-in-cloud

  • 1. Copyright 2016 ITRI 工業技術研究院 0 Android-in-cloud, a combination of android-x86 open source project and Linux container technology COSCUP 2018 工業技術研究院 資料中心系統軟體組 吳天健 (tcwu2005@gmail.com)
  • 2. 1Copyright 2018 ITRI 工業技術研究院 講者自介 With over 15 years of experience in developing assembly, firmware, embedded software and video encoding algorithm on variants of CPUs including x86, Arm, and proprietary processor. I joined ITRI Cloud Computing center of Mobile Application (CCMA) as a system software engineer in 2014. And I've been working on the project "Cloud Execution Platform for Android Containers” since 2016. My research interest includes Hypervisor, Containerization, and Linux kernel.
  • 3. 2Copyright 2018 ITRI 工業技術研究院 回顧 ❖ We were speakers of COSCUP 2017 • https://youtu.be/9W_ZMyany- 0?t=42m27s ❖ In January, 2018, ITRI ICL released the virtual smartphone implementation as “CLONDROID” open source project on github. The project enables one Google Pixel XL handset to run multiple tailored Android containers on it. Android Container on Google Pixel https://github.com/clondroid
  • 4. 3Copyright 2018 ITRI 工業技術研究院 Clondroid: Multiple Your Mobile Phone Linux Kernel + LXC + Drivers Virtual Devices namespace-aware binder Shared service invocation Unshared service invocation Linux Kernel + LXC + Drivers Surface Flinger buffer Host Android Shared Framework Services Surface Flinger Window Manager Android n Window Manager A container-based virtual smartphone open source project initiated by ITRI You are welcome to visit https://github.com/clondroid/cba -aosp-marlin-7
  • 5. 4Copyright 2018 ITRI 工業技術研究院 Clondroid Display Switching between Containers • Layers of different Android containers in SurfaceFlinger • SurfaceFlinger groups layers according to their container ID Assign layers of host container to layersSortedByZ of primary display primary display compose Assign layers of container 1 to layersSortedByZ of primary display primary display compose
  • 6. 5Copyright 2018 ITRI 工業技術研究院 App Streaming in Gaming Industry
  • 7. 6Copyright 2018 ITRI 工業技術研究院 The Needs for App Streaming Cloud Infrastructure ❖ Virtual Android in The Cloud Enables ➢ VMI as a better solution for the BYOD ➢ Mobile cloud-based Gaming-on-Demand services ➢ Cloud gaming bot - online 24/7 ❖ A Case Study - Redfinger Cloud Phone ➢ 5 million subscribers in 2016 ➢ Services and Charge • $9.95 USD / per month for 8 GB Storage, 4 GB RAM ❖ Flexible and Cost Effective Infrastructure Is The Key
  • 8. 7Copyright 2018 ITRI 工業技術研究院 LXC meets Android ❖ To host Android VMs in cloud ➢ Hypervisor ➢ Emulator ➢ LXC + Android ❖ LXC ➢ LXC (Linux Container) = Linux namespace + Cgroup ❖ Android and Its Software Stack Comprises ❖ To containerize Android for cloud, it covers ➢ Linux system ➢ Complete Android-namespaces that Linux namespaces does not ➢ Relative cloud system design (LXC介紹摘錄自wiki) 目前的LXC使用下列內核功能來控制行程: • 內核命名空間(行程間通訊(IPC)、 uts、mount、pid、network和user) • AppArmor和SELinux配置 • Seccomp策略 • chroot(使用pivot_root) • Kernel Capibilities • 控制組(cgroups) 因此,LXC通常被認為介於「加強版」的 chroot和完全成熟的虛擬機器之間的技術。 LXC的目標是建立一個儘可能與標準安裝的 Linux相同但又不需要分離內核的環境。
  • 9. 8Copyright 2018 ITRI 工業技術研究院 Linux vs Android in Software Stack • The Android operating system has its own C library (為了輕薄 短小)called Bionic whereas Linux systems use GNU C library. • Android owns its specific kernel driver, Binder (see kernel/drivers/staging/android/) 這個目錄還有其他的如lmk,ashmem,alarm • Application execution model (i.e. Dalvik VM) • Rootfs (Android’s startup script beginning from init.rc) Source, Aug7,2018 from http://svholla.net/conndots.html
  • 10. 9Copyright 2018 ITRI 工業技術研究院 Why BINDER is crucial in Android? • The existing model is called Android native code • The new one, 依賴BINDER的 Server-client model • Applications and Services may run in separate processes but must communicate and share data. IPC的花費鉅大 • The solution is binder driver to facilitate inter- process communication (IPC) • BINDER not only provide software service • Starting in Android O, the Android framework and HALs now communicate with each other using binder 參考1, Studying Main Differences between Android & Linux Operating Systems Hadeel Tariq Al-Rayes M.Sc. Computer Science Basic Education College-Computer Science Department Diyala University 參考2,The Device Driver Structure for Android with Linux Kernel Driver and Android HAL, William W.-Y. Liang (梁文耀),
  • 11. 10Copyright 2018 ITRI 工業技術研究院 Binder Namespace ❖ Device Namespace ➢ Laadan and his colleagues at Cellrox have put together a set of patches based on the 3.4 kernel for the Android emulator (goldfish) ➢ https://github.com/Cellrox/devns- patches/blob/master/dev_ns__adopt_the_android_binder_driver ❖ Google’s Android binder patch ➢ https://lkml.org/lkml/2016/10/24/339. (patch) ➢ https://sourceforge.net/p/android-x86/kernel/ci/kernel- 4.4/tree/drivers/android/. (directory) Device namespaces, https://lwn.net/Articles/564854/,LWN ,Jake Edge, August 28, 2013 From Martijn Coenen <> Subject [PATCH 06/10] android: binder: support multiple /dev instances. Date Mon, 24 Oct 2016 15:20:34 +0200 share Add a new module parameter 'devices', that can be used to specify the names of the binder device nodes we want to populate in /dev.
  • 12. 11Copyright 2018 ITRI 工業技術研究院 Android Device (HAL) ❖ Android HAL Architecture Linux Device Drivers The new comer: Android HAL 參考, The key issues for teaching or learning Android and Linux Kernel 梁文耀, CTO 和沛移動股份有限公司
  • 13. 12Copyright 2018 ITRI 工業技術研究院 Android Device Virtualization ❖ Device/HALs ➢ Audio ➢ Bluetooth ➢ GPS ➢ Camera ➢ Sensors ➢ Ethernet ➢ Backlight ➢ …族繁不及備載…  Why Android-x86 is a good baseline of Android Containerization • Sensor example https://sourceforge.net/p/android- x86/hardware_libsensors/ci/nougat- x86/tree/ ❖Audio Device Emulation • https://github.com/SVMP/android_de vice_mitre_svmp/tree/svmp- 2.x/libaudio
  • 14. 13Copyright 2018 ITRI 工業技術研究院 Container1 App App App Android Framework Surface flinger Windows Manager Service Manager Input Manager Container2 App App App Android Framework Surface flinger Windows Manager Service Manager Input Manager Container3 App App App Android Framework Surface flinger Windows Manager Service Manager Input Manager Android as Host LXCTools namespaces Graphic Driver Binder Driver Keyboard Driver Mouse Driver Touch-Panel Other Device Drivers Display Virtualization Binder (IPC) Virtualization Input Virtualization …... Device Emulati on …... Device Emulati on …... Device Emulati on ❖ Android-in-cloud DEMO ➢ https://youtu.be/UkxE0e7m1D4 ❖ Android-in-cloud software stacks Android-in-cloud
  • 15. 14Copyright 2018 ITRI 工業技術研究院 Android scheduling ❖ Android’s foreground/background process scheduling 14 /dev/cpuctl/tasks /dev/cpuctl/bg_non_interactive/tasks cpu.shares=1024 cpu.shares=50 ActiveManager jni/android_util_ process.cpp libcutils/sched_ policy.c How set_sched_policy() is called
  • 16. 15Copyright 2018 ITRI 工業技術研究院 ❖ Senario ➢ cpu.shares • specifies a relative share of CPU time available to the tasks in a cgroup ➢ Android assigns system services to bg_non_interactive group ➢ In order to maintain fame rate @ specific level, Android assigns @ least 5% of CPU resources to bg_non_interactive group ❖ Symptom ➢ As the # of containers increases, App UI update frequency is not stable ❖ Reason ➢ 16ms UI Update (ms/per frame) 2 containers system service process cpu.share s Host only system_server, com.android.systemui 5% + con1 system_server, com.android.systemui system_server, com.android.systemui 5% + con2 system_server, com.android.systemui system_server, com.android.systemui system_server, com.android.systemui 5% But there are other Androids…
  • 17. 16Copyright 2018 ITRI 工業技術研究院 Container-aware Scheduler ❖ Solutions ➢ Improve schedule policy, make it to understand there are containers ➢ Assign separated subgroup and shares value to each android container 16ms before UI Update (ms/per frame), 2 containers after system service process cpu.shares Host only system_server, com.android.systemui 5% + con1 system_server, com.android.systemui system_server, com.android.systemui 10% + con2 system_server, com.android.systemui system_server, com.android.systemui system_server, com.android.systemui 15% DEMO@ https://youtu.be/e7 FpZojOj5c
  • 18. 17Copyright 2018 ITRI 工業技術研究院 Network topology design in container-based cloud ❖ Linux bridge , a pure software switch ❖ A simple block of script to enable Linux bridge br0 eth0 veth1 veth2 Android Container 1 eth0 Android Container 2 eth0 DHCP Server SVMP Server Firewall LAN Linux Bridge FOUND=`grep br0 /proc/net/dev` if [ -n "$FOUND" ] ; then echo "br0 exists, skip" else brctl addbr br0 ifconfig eth0 0.0.0.0 brctl addif br0 eth0 dhcptool br0 fi
  • 19. 18Copyright 2018 ITRI 工業技術研究院 Pitfalls of Linux bridge ❖ You don’t need to enable IP forwarding ❖ Unexpected bridge netfilter behavior ❖ Be sure in promiscuous mode ### NOT NECESSARY TO ENABLE ROUTING ### ###echo 1 > /proc/sys/net/ipv4/ip_forward ### IF THERE IS BRIDGE NETFILTER, DISABLE THEM ### for f in /proc/sys/net/bridge/bridge-nf-* ; do echo 0 >$f ; done make sure promiscuous mode enables ● in hypervisor, check network setting ● in physical machine For promiscuous mode, IFF_PROMISC, 0x100 should be set. $ cat /sys/devices/virtual/net/veth0/flags 0x1303 # 0001 001[1] 0000 0011 # device is in promiscuous mode. $ cat /sys/devices/virtual/net/br0/flags 0x1003 # 0001 000[0] 0000 0011 # device is not in promiscuous mode.
  • 20. 19Copyright 2018 ITRI 工業技術研究院 GetMAC() { if [ -n "$1" ]; then ##OID="02:16:3e" OID_PREFIX="02" OID_SUFIX=$(cat /sys/class/net/peth0/address | md5sum | sed 's/(..)(..).*/1:2/') OID="$OID_PREFIX:$OID_SUFIX" echo OID=$OID RAND=$(echo $1 | md5sum | sed 's/(..)(..)(..).*/1:2:3/') echo "$OID:$RAND" else echo "ERROR: please supply hostname to create MAC address from, e.g.:" echo " $FUNCNAME myhost" fi } Mac address assignment In a container-based cloud, mac addresses of each container should be  Pre-assigned  Lower address (br0 automatically take away new enslaved nic card’s mac address if it’s lower)  Manageable (設想你有上百甚至上千個容器要管理,要生成,指派,出錯的時 候大略判定mac所屬的區段) tcwu2005@itri-29:~$ GetMAC con1 02:9f:8b:8e:52:8e tcwu2005@itri-29:~$ GetMAC con2 02:9f:8b:17:52:5b tcwu2005@itri-29:~$ GetMAC con3 02:9f:8b:37:1b:c9
  • 21. 20Copyright 2018 ITRI 工業技術研究院 X86 Server GPU Test container# avg.fps sum.fps 1 60 60 5 60 300 10 34.6 346 15 24.2 363 20 18.5 370 30 13.97 419 • Hardware: rack mount server MI1200 • GPU: Intel embedded core ‘gt4e’, 2/3 of area 210-220mm2 is for gpu • In each container , run test app ‘seascape’ , a small size (4MB) GPU benchmark with highly realistic dynamic ocean render using OpenGL ES 2.0 and specific glsl shader features 0 20 40 60 80 0 10 20 30 40 avg.fps 0 50 100 150 200 250 300 350 400 450 0 5 10 15 20 25 30 35 sum.fps 1. Container numbers of 1 and 5 , average fps is 60 and no more than that, guess it’s fixed to system (system fps = 1/vsynv_period) 2. More benchmark applications executed simultaneously, the total bandwidth of gpu reaches around four hundreds of frames per second
  • 22. 21Copyright 2018 ITRI 工業技術研究院 ITRI OPEN SOURCE PROJECTS ❖ Cuju: An Open Source Project for QEMU/KVM based Fault Tolerance ❖ CLONDROID: A Container based Virtual Smartphone Open Source Project to allow you to run multiple Android-OS on single Google Pixel XL. Separate work and personal data easily. https://github.com/clondroid
  • 23. 22Copyright 2018 ITRI 工業技術研究院 工研院 (ITRI) COSCUP 2018 徵才活動 # 徵才ing ❖ 工研院資通所目前正在尋求具有以下 經驗跟能力的人才: - 系統安全 - 軟體安全 - 虛擬化系統 - Container (LXC) - IaaS / PaaS / SaaS - Android 作業系統 - 軟體定義式儲存系統 - 快閃記憶體磁碟陣列系統 - 深度學習 - DevOps - UI / UX engineering - I/O 虛擬化 - CEPH Software Storage Platform ❖ 請留下您的聯絡方式,並告訴我們您 有興趣的職缺。 # We are hiring! ❖ We are ITRI Information and Communication Labs (ICL). We need people who have the following talents: - System security - Software security - Virtualization - Container (LXC) - IaaS / PaaS / SaaS - Android operating system - Software-defined storage - All flash array - Deep learning - DevOps - UI / UX engineering - I/O virtualization - CEPH Software Storage Platform
  • 24. 23Copyright 2018 ITRI 工業技術研究院 Container-Based-Android Team Members Tzi-cker Chiueh, General Director of ICL/ITRI Victor Hsu Tian-Jian Wu Te-Yu Tsai I-Fan WangIan TsaiSting Cheng