LECT - 3b: Mobile-Platform Solutions: 10 March 2020

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

LECT_3b: Mobile-

platform solutions

10th March 2020


Mobile
Platforms
1. Android

• A full set of software for mobile devices and includes an operating


system, middleware and key mobile applications.
• Originally created by Android Inc., which was bought by Google in
2005.
• Google published Android in 2007 and formed the Open Handset
Alliance (OHA) with a group of other technology companies, device
manufacturers and wireless carriers.
• Today Open Handset Alliance houses more than 80 companies,
dedicated to developing and distributing Android.
1.1 Android – The System Architecture

• Architecture as a stack of various components, divided into FIVE


layers.
• Built on a modified Linux 2.6 series kernel that provides core system
services such as security, memory management, process
management, network stack and driver model.
• The kernel and low level tools are contained in the bottom layer.
• The basic libraries included in Android are programmed in C and C++,
and are accessed through the Android application framework (layer 2)
1.2 Android – The Runtime

• Contains a set of Java core libraries and the Dalvik virtual machine
(VM).
• The Dalvik VM executes files in Dalvik Executable (.dex) format,
usually transformed from Java byte code to Dalvik byte code.
• Every Android application runs in its own process with its own
sandboxed instance of Dalvik VM.
• Dalvik has been optimized so that a device can run multiple VMs at
the same time efficiently.
• The kernel also provides an abstraction of the underlying hardware
for the rest of the software stack.
1.3 Application Framework Layer

• Gives the developers access to the same framework Application


Programming Interfaces (API) used by the core applications.
• Frameworks - written in Java and provide abstractions of the Android
libraries and the features of the Dalvik VM.
• The top of the stack – reside the applications.
• Both core and third-party applications have equal access to the device’s
capabilities, such as making calls or using the camera.
• Also access capabilities of other applications, within security constraints.
• Users can also replace any core application with another application, and
have their device use the new application by default.
1.4 Android SDK – Developed Android apps

• Usually with the Java programming language.


• The SDK provides the API libraries and developer tools for building,
testing and debugging for Android.
• Development can be done in any of the current major operating
systems and an IDE of choice, although Google recommends using
Android Studio.
• Common option – Eclipse IDE with Android Developer Tools (ADT) plugin,
provided by Google, which integrates the Android SDK into Eclipse. (AS)
• The ADT allows the developer to test the application with an Android
emulator or a connected device and provides a graphical editor for building
the user interface (UI) of the application.
2. Android Runtime – Dalvik versus ART

• Dalvik Virtual Machine (DVM) – process virtual machine (VM) in


Google's Android operating system
• Specifically executes applications written for Android
• Dalvik an integral part of the Android software Stack

• ART – used by OS which takes care of converting the code that you
write in HLP (e.g., Java) to machine code and understand by CPU.
• ART – comprises of software instructions that execute when program
is running.
2.1 JAVA Code Execution

• Java Virtual Machine (JVM) - to maintain the platform independency


of the code
• It developed JVM specific to every platform
• JVM is dependency on the platform.
• The Java compiler converts the .java files into .class files, which is
called byte code.
• This byte code is given to the JVM which converts it into machine code.
2.2 Android Code Execution – The works

• Android – Java classes are converted into DEX bytecode.


• The DEX bytecode format - translated to native machine code via
either ART or the Dalvik runtimes.
• DEX bytecode is independent of device architecture.

• Dalvik – (Just in time) compilation-based engine


• ART – (Ahead of time) compilation
Dalvik VM
versus
JVM
2.3 Just In Time (JIT) – Dalvik

• JIT compiler - Each time when the app is run, it dynamically translates
a part of the Dalvik bytecode into machine code.
• As the execution progresses, more bytecode is compiled and cached.

• Since JIT compiles only a part of the code, it has a smaller memory
footprint and uses less physical space on the device.
2.5 Ahead Of Time (AOT) – ART

• During the app’s installation phase, it statically translates the DEX


bytecode into machine code and stores in the device’s storage.
• A one-time event which happens when the app is installed on the device.
• The code executes much faster.

• As ART runs app machine code directly (native execution), it doesn’t


hit the CPU as hard as JIT code compiling on Dalvik.
• Because of less CPU usage results in less battery drain.
2.6 ART - Drawbacks

• App Installation takes more time because of DEX bytecodes


conversion into machine code during installation.

• As the native machine code generated on installation is stored in


internal storage, more internal storage is required.
• ART also uses same DEX
bytecode as input for Dalvik.

• An application compiled using


ART requires additional time
for compilation when an
application is installed
• Take up slightly larger amounts
of space to store the compiled
code.
2.7 Why Android use VM?

• Use of a VM as its runtime environment in order to run the APK files


that constitute an Android application.
• The advantages:
1. The application code is isolated from the core OS. So even if any code
contains some malicious code won’t directly affect the system files.
2. It makes the Android OS more stable and reliable.
3. It provides cross compatibility or platform independency.
4. It meaning even if an app is compiled on platform such as a PC, it can still be
executed on the mobile platform using the virtual machine.
References

1. https://aaltodoc.aalto.fi/bitstream/handle/123456789/16008/master_Ottka_S
anna_2015.pdf?sequence=1&isAllowed=y

You might also like