Flexible Updates of Embedded Systems Using Containers
Total Page:16
File Type:pdf, Size:1020Kb
DEGREE PROJECT IN MECHANICAL ENGINEERING, SECOND CYCLE, 30 CREDITS STOCKHOLM, SWEDEN 2016 Flexible Updates of Embedded Systems Using Containers SANDRA AIDANPÄÄ ELIN MK NORDMARK KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF INDUSTRIAL ENGINEERING AND MANAGEMENT Master of Science Thesis MMK2016:92 MDA 565 Flexible Updates of Embedded Systems Using Containers Sandra Aidanpa¨a¨ Elin MK Nordmark KTH Industrial Engineering and Management Approved Examiner Supervisor 2016-06-13 De-Jiu Chen Viacheslav Izosimov Commissioner Contact person Tritech AB Mats Malmberg Abstract In this thesis the operating-system-level virtualization solution Docker is investigated in the context of updating an embedded system on application level. An updating sequence is designed, modelled and implemented, on which experiments are conducted to measure uptime and current. Within the popular notion of the Internet of Things, more and more things are being connected to the Internet and thereby the possibility of dynamic updates over the Internet is created. Being able to update remotely can be very beneficial, as systems may be costly or unpractical to reach physically for software updates. Operating-system-level virtualization, software contain- ers, are a lightweight virtualization solution that can be used for dynamic updating purposes. Virtualization properties, like resource isolation and letting software share hardware capabili- ties are used in determining the architecture. The container architecture used is a microservice architecture, where systems are composed from many smaller, loosely coupled services. The application area for the results of this thesis are start-ups in the Internet of Things field, delimited to low complexity systems such as consumer products. The update regime is created with the properties of microservice architectures in mind, creating a self-propelling, self-testing, scalable and seamless dynamic updating process that can be used for systems of different complexity. The update regime is modeled to give proof of concept and to help design the implementation. The implemented update regime was made on an ARM based single board computer with a Linux-kernel based operating system running Docker. Experiments were then conducted in order to give a clear indication of the behavior of a dynamically updated embedded system. The experiments showed that the update regime can be seamless, meaning that the uptime properties are not affected by this kind of updating. The experiments also showed that no significant changes in current can be noted for container limitations during this kind of update. Master of Science Thesis MMK2016:92 MDA 565 Flexibel uppdatering av inbyggda system med hjalp¨ av containrar Sandra Aidanpa¨a¨ Elin MK Nordmark KTH Industrial Engineering and Management Approved Examiner Supervisor 2016-06-13 De-Jiu Chen Viacheslav Izosimov Commissioner Contact person Tritech AB Mats Malmberg Sammafattning I denna uppsats unders¨oksvirtualiseringsl¨osningenDocker i samband med uppdatering p˚a applikationsniv˚ai ett inbyggt system. En uppdateringsekvens ¨arutformad, modellerad och genomf¨ord,samt experiment genomf¨ordaf¨oratt m¨ataupptid och str¨om. Samh¨alletblir mer och mer uppkopplat, fler och fler saker ¨aranslutna till Internet och d¨armed skapas m¨ojligheterf¨ordynamiska uppdateringar via Internet. Att kunna genomf¨orafj¨arr- uppdateringar kan vara v¨aldigtf¨ordelaktigteftersom det kan vara dyrt eller opraktiskt att fysiskt n˚asystem f¨orprogramuppdateringar. Operativsystemniv˚a-virtualisering,mjukvarucontainrar, ¨aren l¨attviktigvirtualiseringsl¨osningsom kan anv¨andasf¨ordynamiska uppdaterings¨andam˚al. Virtualiseringsegenskaper, s˚asomresursisolering och att programvara delar h˚ardvarufunktioner, anv¨andsf¨oratt best¨ammaarkitekturen. Containerarkitekturen som anv¨ands¨aren mikrotj¨anst- arkitektur, d¨arsystemen ¨aruppbyggda av m˚angamindre, l¨ostkopplade tj¨anster. Anv¨andningsomr˚adetf¨orresultaten av denna avhandling ¨arnystartade f¨oretagsom befinner sig i marknadsomr˚adetf¨ordet uppkopplade samh¨allet,begr¨ansattill system med l˚agkomplexitet s˚asomkonsumentprodukter. Uppdateringssekvensen skapas med egenskaperna hos mikrotj¨anstarkitektureri ˚atanke; en sj¨alv- g˚aende,sj¨alvtestande,skalbar och s¨oml¨osdynamisk uppdateringsprocess, som kan anv¨andas f¨orsystem av olika komplexitet. Uppdateringssekvensen modelleras f¨oratt ge bevis p˚akon- ceptet och f¨oratt underl¨attautformningaen av genomf¨orandet. Den genomf¨ordauppdater- ingssekvensen gjordes p˚aARM-baserad enkortsdator med ett Linux-k¨arnbaserat operativsystem som k¨orDocker. Experiment utf¨ordessedan f¨oratt ge en tydlig indikation p˚abeteendet vid dynamisk uppdatering av ett inbyggt system. Experimenten visade att uppdateringssekvensen kan vara s¨oml¨os,vilket inneb¨aratt upptid- egenskaperna inte p˚averkas av denna typ av uppdatering. Experimenten visade ocks˚aatt inga v¨asentliga f¨or¨andringari str¨omkan noteras f¨orbegr¨ansningarav containern under denna typ av uppdatering. Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law. - Douglas Hofstadter Contents 1 Introduction 1 1.1 Background . .1 1.2 Objectives . .1 1.3 Scope . .3 1.4 Method . .3 1.5 Sustainability . .4 1.5.1 Environmental Sustainability . .4 1.5.2 Social Sustainability and Ethics . .5 1.5.3 Economical Sustainability . .5 1.6 Reading Instructions . .5 2 Prestudy 7 2.1 Definitions . .7 2.2 Target Market and Parameters of Interest . .7 2.2.1 Taxonomy of System Parameters . .7 2.2.2 Target Market . .8 2.3 Taxonomy of Virtualization . 11 2.4 Linux Containers . 13 2.4.1 Docker . 14 2.4.2 Related Work . 17 2.4.3 Docker Compatible Hardware . 18 2.5 Remote Update . 21 2.5.1 Dynamic Software Updating . 22 2.5.2 Microservices Principle . 23 3 Implementation 27 3.1 Update Regimes with Containers . 27 3.2 Design Guidelines . 29 3.3 Overview of the Chosen Updating Regime . 30 3.4 Detailed Model . 31 3.5 Implementation Setup . 34 3.5.1 Platform Specifics . 34 3.5.2 Docker . 35 3.5.3 Development Environment . 35 3.6 Container Implementation . 36 3.6.1 Hardware Specific Container . 36 3.6.2 Application Containers . 37 3.6.3 Container Communication . 38 4 Experiment Design 41 4.1 Experiment Method . 41 4.1.1 EX 1: Normal Distribution Check . 42 4.1.2 EX 2: 2-factor, Full Factorial 2-level Experiment with Center Points . 42 4.1.3 EX 3: 2-factor, Full Factorial 3-level Experiment . 43 4.2 Analysis . 43 4.3 Measurements . 43 4.3.1 Actuator Signals . 43 4.3.2 Changes in Current . 44 5 Result 45 5.1 Uptime . 45 5.1.1 EX 1: Normal Distribution Check . 45 5.1.2 EX 2: 2-factor, Full Factorial 2-level Experiment with Center Points . 47 5.1.3 Comparison to Behavior Without Container . 48 5.2 Current Measurements . 50 5.2.1 EX 1: Normal Distribution Check . 50 5.2.2 EX 2: 2-factor, Full Factorial 2-level Experiment with Center Points . 50 6 Conclusion 55 7 Discussion 57 7.1 Result . 57 7.2 Update Regime and Model . 57 7.3 Implementation . 59 7.4 Method . 59 7.5 Security . 59 8 Future Work 61 9 Bibliographies 63 A Work Division I B Hardware List III C Model V D Code XV D.1 Docker Files . .XV D.2 GPIO Container . XVI D.3 Application Containers . XXIV Abbreviations ADC Analog to Digital Converter API Application Programming Interface App Application appc App (application) Container (project) ARM Advanced RISC Machine BCET Best-Case Execution Time BSD Berkeley Software Distribution CISC Complex Instruction Set Computing CPS Cyber-Physical System CPU Central Processing Unit CSV Comma Separated Value DSP Digital Signal Processors DSU Dynamic Software Updating ES Embedded System FPGA Field-Programmable Gate Array GNU GNU's Not Unix GPIO General Purpose Input/Output GPL General Public Licence GPU Graphics Processing Unit HDMI High-Definition Multimedia Interface HPC High Performance Computing HTTPS HyperText Transfer Protocol Secure IBM International Business Machines Corporation I/O Input/Output I2C Inter-Integrated Circuit ID Identifier IoT Internet of Things IP Internet Protocol IT Information Technology KVM Kernel-based Virtual Machine LED Light-Emitting Diode lmctfy let me contain that for you LXC LinuX Containers MIPS Microprocessor without Interlocked Pipeline Stages NPB NAS Parallel Benchmarks OCI Open Container Initiative OS Operating System PC Personal Computer PID Proportional{Integral{Derivative PLC Programmable Logic Controller PMMU Paged Memory Management Unit PWM Pulse Width Modulation PXZ Parallel XZ RAM Random Access Memory RISC Reduced Instruction Set Computing RMS Root Mean Square ROM Read-Only Memory RQ Research Question SBC Single-Board Computer SD Secure Digital SMPP Short Message Peer-to-Peer SoC System-on-a-Chip STREAM Sustainable Memory Bandwidth in Current High Performance Computers TCP Transmission Control Protocol UDP User Datagram Protocol UHS Ultra High Speed UI User Interface UML Unifed Modeling Language USB Universal Serial Bus VM Virtual Machine VMM Virtual Machine Monitors VPS Virtual Private Server WCET Worst-Case Execution Time 1 Introduction 1.1 Background This thesis investigates how containers for Linux-like operating systems (built on the Linux kernel), specifically Docker, can be used for updating the software of mechatronical and em- bedded products. Containers, also called operating-system-level virtualization, is a technique for resource isolation that lets software share the hardware capabilities of a computer using virtualization. Containers, however, differ from virtual machines in the way that they do not simulate the hardware, instead