Evaluating Android OS for Embedded Real-Time Systems
Total Page:16
File Type:pdf, Size:1020Kb
Evaluating Android OS for Embedded Real-Time Systems Claudio´ Maia, Lu´ıs Nogueira, Lu´ıs Miguel Pinho CISTER Research Centre School of Engineering of the Polytechnic Institute of Porto Porto, Portugal Email:{crrm,lmn,lmp}@isep.ipp.pt Abstract—Since its official public release, Android has cap- the use of a VM environment, with both its advantages and tured the interest from companies, developers and the general known problems. audience. From that time up to no!, this software platform Ne&ertheless, there are features which ha&e no' been has been constantly improved either in terms of features or supported hard!are and, at the same time, e"tended to new explored yet, as for instance the suitability of the platform types of devices different from the originally intended mobile to be used in Open Real-Time environments. Taking into ones. However, there is a feature that has not been explored consideration orks !ade in the past such as [4], [9], either yet - its real-time capabilities. concerning the Linux 5ernel or VM environments, there This paper intends to explore this gap and provide a basis is the possibility of introducing temporal guarantees allied for discussion on the suitability of Android in order to be used in Open Real-Time environments. By analysing the software with Quality of Service (QoS) guarantees in each of the platform, with the main focus on the virtual machine and its aforementioned layers, or e&en in both, in a ay that a underlying operating system environments, we are able to point possible integration !ay be achie&ed, fulfilling the temporal out its current limitations and, therefore, provide a hint on constraints imposed #% the applications. This integration different perspectives of directions in order to make Android may be useful for mul'imedia applications or e&en other suitable for these environments. types of applications requiring specific machine resources It is our position that Android may provide a suitable architecture for real-time embedded systems, but the real-time that need to be guaranteed in an advanced and timely community should address its limitations in a joint effort at manner. Thus, taking advantage of the real-time capabilities all of the platform layers. and resource optimisation provided #% the platform. Keywords-Android, Open Real-Time Systems, Embedded Currently, the Linux 5ernel provides mechanisms that Systems allo a programmer to ta5e advantage of a basic "reempti&e -4ed priority scheduling polic%. Howe&er, when using this I. INTRODUCTION type of scheduling poli$% it is not possible to achie&e real- time behaviour. >(forts ha&e been made in the i!plemen- Android [1] as made "ublicly a&ailable during the (all tation of dynamic scheduling schemes which, instead of of 2008. Being considered a (airly ne technology, due using -4ed priorities (or scheduling, use the $oncept of to the (act that it is still being substantially impro&ed and dynamic deadlines. These dynamic scheduling schemes ha&e upgraded either in terms of features or firmware, Android the advantage of achieving full CPU utilisation #ound, #ut is gaining strength both in the mobile industry and in other at the same time, the% "resent an unpredictable behaviour industries with different hardware architectures (such as the when (acing system o&erloads. ones presented in [2] and [3]). The increasing interest from Since &ersion 2.6.23, the standard Linux 5ernel uses the the industry arises fro! ' o core aspects: its open-source Completely @air Scheduler (CFS), which applies (airness in nature and its architectural model. the ay that CPU time is assigned to tasks. This balance Being an open-source project, allows Android to be fully guarantees that all the tasks will ha&e the same CPU share analysed and understood, which enables feature compre- and that, each time tha' unfairness is &erified, the algo- hension, #ug fixing, further impro&ements regarding ne rithm assures that task re-balancing is performed. Although functionalities and, -nall%, porting to ne hardware. On the (airness is guaranteed, this algorithm does not "rovide an% other hand, its Linux 5ernel-based architecture !odel also temporal guarantees to tasks, and therefore, neither Android adds the use of Linux to 'he mobile industry, allo ing to take does it, as its scheduling operations are delegated to the advantage of the kno ledge and features offered #% Linux. Linux 5ernel. Both of these aspects !a5e Android an appealing target to Android uses its own 6M named Dalvik, which as be used in other type of environments. specifically de&eloped (or mobile devices and considers Another aspect that is i!portant to consider when using memory optimisation, #attery power saving and lo fre- Android is its own 6irtual Machine (VM) en&ironment. quenc% CPU. It relies on the Linux 5ernel for the core Android applications are Ja&a-based and this (actor entails operating system features such as memory management and 63 scheduling and, thus, also presents the dra #a$5 of not taking an% temporal guarantees into consideration. The ork presented in 'his paper is part of the Cooper2 atES (Cooperati&e >mbedded Systems) projec' [6], which aims at the specification and implementation o( a QoS- a are frame ork, defined in [7], to be used in open and dynamic cooperati&e en&ironments. Due to the nature of the environments, the frame ork should support resource reser2 &ation in advance and guarantee that the real-time e4ecution constraints imposed #% 'he applications are satisfied. In the scope of the project, there as the need of e&al- uating Android as one of the possible target solutions to be used for the frame ork’s implementation. As a result of this e&aluation, this paper discusses the potential o( Android and the implementation directions that can be adopted in Figure 1. Android Architecture order to make it possible to be used in Open Real-Time environments. Howe&er, our focus is targeted to soft real- time applications and therefore, hard-real time applications the applications. Among all the libraries provided, the most were not considered in our e&aluation. important are libc, the standard C system library tuned for The remainder of this paper is organised as follo s: Sec- embedded Linux-based devices; the Media Libraries, which tion II briefly describes the Android’s architecture. Section support playback and recording of se&eral audio and video III presents a detailed e&aluation along with so!e of the formats; Graphics Engines, @onts, a lightweigh' relational Android internals and its limitations when considering real- database engine and /D libraries based on OpenGL ES. time environments. The different perspecti&es of extension Regarding the Android Runtime, besides the internal core are detailed in Section IV. Finally, Section 6 concludes this libraries, Android provides its own VM, as pre&iously stated, paper. named Dalvik. Dalvi5 [F] as designed from scratch and it is specifically targeted (or memory-constrained and CPU- II. ANDROIDB; ARC=IT>CTUR> constrained devices. I' runs Ja&a applications on top of it Android is an open-source software architecture "rovided and unlike the standard Ja&a VMs, which are stack-based, #% the Open Handset Alliance [8], a group of 71 'echnology Dalvik is an infinite register-based machine. ,eing a register2 and mobile companies whose objecti&e is to provide a machine, it presents ' o advantages when co!pared to mobile software platform. stack-based machines. Namely, it requires /*G less instruc- The Android platform includes an operating system, tions to perform the sa!e computation as a '%"ical stack middle are and applications. As for the features, Android machine, causing the reduction of instruction dispatch and incorporates the common features found no adays in an% memory access; and less computation time, hich is also mobile device platform, such as: application frame ork deri&ed from the elimination of common expressions from reusing, integrated browser, optimised graphics, !edia sup- the instructions. Ne&ertheless, Dalvik presents /9G more port, network technologies, etc. bytes in the instruction stream than a typical sta$5-machine. The Android architecture, depicted in Figure 1, is com- This drawback is compensated #% the consumption of ' o posed #% -&e layers: A"plications, Application @rame ork, bytes at a time when consuming the instructions. Libraries, Android Runtime and finally the Linux 5ernel. Dalvik uses its own #%'e-code format name Dalvik >42 The uppermost layer, the Applications layer, provides the ecutable ..dex), with the ability to include multiple classes core set of applications that are commonly offered out of in a single file. It is also able to perform se&eral optimi- the box with an% mobile device. sations during dex generation when concerning the internal The Application Frame ork layer provides the frame ork storage of types and constants #% using principles such as Application Programming Interfaces (APIs) used #% the minimal repetition; "er2'ype pools; and implici' labelling. applications running on the uppermost layer. ,esides the ,% applying these principles, it is possible to ha&e dex files APIs, there is a set of services that enable the access to smaller than a typical 7a&a archi&e .jar0 file. During install the Android’s core features such as graphical $omponents, time, each dex file is &erified and optimisations such as byte- information exchange managers, e&ent managers and activity swapping and padding, static-linking and method in-lining managers, as examples. are performed in order to minimise the runtime e&aluations Belo the Application @rame ork layer, there is another and at the same time to a&oid code security violations. layer containing ' o important parts: Libraries and the The Linux 5ernel, &ersion 2.6, is the bottommos' layer Android Runtime.