1. just-in-time compilation to translate Java byte code

1. Introduction

Mobile phones becomes a basic necessity of our digital world.
First computer and now smart mobile phones revolutionize our every aspect of
life. Modern smart mobile phones are closer to handheld computers that enable
us to perform many task like make video calls, photography, mailing, watch
videos, social media, perform banking tasks and much more besides. Now a day’s
most popular mobile operating systems are Android and iOS.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

1.1 Android VS iOS

Android and iOS are the two top most leading Mobile operating
system in the world. Android is launched by Google Inc. initial release was on
23rd September 2008(9 years ago) basically designed for touch screen
mobiles devices later than also developed for Android TV, android auto and
Android wear, Most of the Android
core is released under the open-source Apache License but a large amount of
software on Android devices (such as such as Play Store, Google Search, Google
Play Services, Google Music, and so on) are proprietary and licensed 15. Android
forked from a Linux kernel Long-term support (LTS) branches with higher-level
APIs. Since android run
on a modified Linux kernel it have a monolithic style of kernel. Android written in C language and
applications are normally programmed in Java and run with the Dalvik virtual
machine (DVM) using just-in-time compilation to translate Java byte code into
Dalvik dex-code 3. This combination brings up some secure features, like
efficient shared memory management, preemptive multitasking, UNIX user identifiers
(UIDs) and file permissions with the type safe concept of Java. Every Android
application runs in a separate process under a unique UID with distinct permissions,
which means that applications can typically not read or write each other’s data
or code. The kernel sandboxes applications from each, so that resource and data
must be share explicitly. To make a resource share between applications
possible, the permissions which are required must be declare statically at the
time the application is installed. The Android system prompts the user for
consent at this time; a mechanism for granting permission dynamically at
runtime is not possible and would lead to an increase of security transparency
20.

iOS (previously
iPhone OS) is a mobile operating

System developed by
Apple Inc. and distributed

Exclusively for Apple
hardware 6. It is the operating system that powers iPhone, iPad, iPod Touch,
and Apple TV. iOS is based on open source
Darwin (BSD) and macOS forked from UNIX operating system. iOS is closed source OS. iOS promoted a new style of user interaction
for small screen, limited input devices, specifically, direct manipulation.
Touch-based gestures like swipe, tap, tap and hold, and pinch are used to control
on-screen interface elements, and to perform interface operations.
Accelerometers support additional physical gestures like shaking and rotating
the orientation of the device 15.

 

Now a days 99% mobile devices are
powered by android and iOS so the market is also occupied by these two of Operating
Systems. According to recent stats 85% market share is occupied by Google Android
14% by Apple IPhone iOS and 1% by others mobile operating system. According to official
Press releases of Google and Apple which states that over 2 billion android
devices are monthly active and over one billion iOS devices active worldwide.

 

2. Process and Thread Management

Table 1: process and
thread management

 

Android

iOS

Single thread of
execution

Yes

Yes

Separate process
for app components

Yes

Yes

Separate Threads
for app components

Yes

Yes

Controlling of
process

Yes

No

Process shutdown
by OS

Yes

yes

foreground Process

Yes

yes

Process States

Yes

Yes

Visible process

Yes

yes

Background process

Yes

yes

Using of threads

Yes

yes

Interposes
communication (IPC)

Yes

Yes

Remote procedure
calls

Yes

No

URL scheme for IPC

No

yes

Performing I/O
operation

Yes

yes

 

2.1 Android Process and
Thread Management

In Android Operating system when a new application start
running, system create and start a new process for that application with only a
single thread of execution. There is a main thread in every application which
is known as User Interface (UI) thread. Basically every thread, component and
parts of the application work under this UI thread. Every process is made up of
more than one threads. Some thread run dependently and some independently
depending upon the application. Each and every thread always remain inside of
the process virtual memory and address space of the process. If a new
application need to start and there is not enough space in the memory then android
forcefully shut down the process according to their importance to create space
for new process. There is a hierarchy of processes to determine which process
will be killed first or last while system is low on memory, in android hierarchy
is like this form high to low. Foreground process, visible process, service
process, background process & empty process. The list is based on
“importance hierarchy”. It mean importance of first process is high so it will
be killed at last while last one killed first. There are different states of a
process. In android states are created, running, paused, stopped & killed.
There is proper mechanism in android for inter process communication (IPC).
This mechanism is called remote procedure RPCs. Process can always perform I/O
operations for their proper working.

2.2 iOS Process and
Thread Management

iOS also create and start a new process for application which
is newly start with a single thread of execution. Every process is made up of
more than one thread and there is main thread which control the main
functionality of the application. Every thread can perform I/O operation. when
a new thread created inside main thread that thread run independently inside
the same virtual memory and address space of process. . If a new application
need to start and there is not enough space in the memory then iOS forcefully
shut down the process according to their importance to create space for new
process. There is a hierarchy of processes to determine which process will be
killed first or last while system is low on memory. The hierarchy is same like this
high to low. Foreground processes, background processes, suspended processes
& not running processes, the list is based on “importance hierarchy”  it mean importance of first process is high
so it will be killed at last while last one killed first. There are different
states of a process, in iOS states of process are, not running, active,
inactive, background & suspended. In iOS two techniques are used for IPC which
is Grand central dispatch and pasteboard.

3. Memory Management

Memory management is a very important aspect of every modern
operating system. Mobile operating systems like android and iOS handle and manage
memory very efficiently.

Table 2: Memory Management

 

Android

iOS

Virtual memory

Yes

Yes

Page size

4kb

4-16kb

ARC

No

Yes

Garbage collector

Yes

No

Generational
memory heap

Yes

No

Eden space

Yes

no

Survivor space

Yes

No

Tenured space

Yes

no

Permanent space

Yes

No

Autorealease pools

No

yes

Auto deallocation

No

Yes

Factory method

No

yes

GC of java

Runtime

ARC of mac OS X

Compile time

Memory share

Yes

No

Voluntarily free
up memory

No

yes

 

3.1 Android Memory
Management

Android use memory mapping and paging to handle memory
problems. Page size is of 4kb. Any application old or new can’t be removed from
memory and remain in the main memory until that application releases the object
references it holds and making the occupied memory available for Garbage
Collector (GC) to Clean. Inside a managed memory environment like in android
system keep track of its memory allocation. The technique of reclaiming unused
memory from application after determining that a piece of memory is no longer
used by any application is called garbage cleaning. There are two goals of a
GC. Finding those type of data object which are not accessed in future and
reclaiming the memory used by those data objects. Android memory is
generational type of memory. In generational memory there are three type of
generation young generation, old generation and permanent generation. The newly
created object stays in young generation. When an object lives long then that
object transfer to older generation. Young and old generation are further
divided into to Eden and survivor space generation, tenured generation.
Permanent generation is a generation where classes of java and method object
resides in it. GC of java works at runtime. In generational memory every
generation has it own upper limit that when will garbage collector start and
how long it remain active for cleaning and how many data object remain in a
generation.

3.2 iOS memory
management

iOS support full time virtual memory environment. Page size
is same as android 4kb but some hardware support 16kb of page size. MAC OSX uses
garbage collector of objective C rather than iOS based on MAC OSX it don’t use
GC for memory cleaning. It uses another technique which is known as Automatic
Reference counter (ARC). The main methods of ARC are retain and release and
these methods are inserted in code at compile time. In ARC when an object is
created or copy of object is created it’s retain count become 1. When any other
object shows an ownership interest in a object its retain count increases to 2
and whenever owner releases it ownership its retain count reduced by 1. When
the retain count become zero the object is destroyed. There is a auto release
pool when an object is placed in this then that object is release after the
program execution exits beyond the scope. There is a method auto deallocation
when retain count of a object becomes zero the deallocation method is call to reclaim
the resource. iOS applications voluntarily free up memory for another
applications.

4. Virtual Memory

Android and iOS both support full time virtual memory environment
comparison of both OS virtual memory is give below

Table 3: Virtual
Memory

 

Android

iOS

Virtual memory
support

Yes

Yes

Memory mapping

Yes

Yes

Paging

Yes

Yes

Page size

4kb

4-16 kb

Virtual address

Yes

Yes

Physical address

Yes

Yes

Swapping

No

Yes

Logical address
space

Yes

Yes

Thrashing

No

yes

Memory management
unit MMU

Yes

yes

 

4.1 Android Virtual
memory

As we know that Android OS is Linux
based and it proves that it can run with minimum hardware resources. Application
on Android run inside the Dalvik Virtual Machine but not executed as local
applications. The Dalvik Virtual Machine allows multiple virtual machine instances
to run at once and Dalvik Virtual Machine is registered based virtual machine
which optimizes for low memory requirements. The Dalvik Virtual Machine (DVM)
is made to run Java applications, but DVM is not a JVM. DVM runs Java applications
that are converted into Dalvik executable file format. The lack of a just in
time compiler is huge difference between DVM and other JVMs. As it optimized
for low memory needs to run the application inside the VM is without any hesitation
memory compared to an architecture which uses local application and lack of
just in time compiler could minimize the performance. Android support virtual memory and use memory mapping
and paging to implement virtual memory. Page size is of 4 kb. Two types of
addresses are generated in virtual memory one is physical address and other is
virtual address. When system is low on memory android kill the apps according
to priorities but don’t support swapping of apps to secondary memory from main
memory. In android every process remains in its own separate logical address.

4.2 iOS virtual memory

The 1st generation
iPhone offer 128 MB memory while 3rd generation iPhone offers 256 MB that is
twice as compared to the 1st generation iPhone, allowing to improve the
performance as well as multitasking. Near about 11MB of 128 MB is used for
virtual RAM and operating system itself uses a large chunk of memory and
remaining approximately 76 MB memory is for user. IPhone OS does not contain
swap file for virtual memory, this indicates that when RAM is full then there
is not any available memory any more. iOS
also support virtual memory and use memory mapping and paging to implement Virtual
Memory. Page size is of 4kb but in some hardware support 16kb page size. Two
type of address are generated in this virtual memory one is physical address
and other is virtual address. When system is low on memory iOS kill the apps
according to priorities but also support swapping of apps to secondary memory
from main memory to free up memory for new apps. In iOS every process remains
in its own separate logical address.

5. Processes and threads Scheduling

Table 4: Process and Thread Scheduling

 

Android

iOS

Priority based scheduling

Yes

yes

Normal priority

Yes

Yes

Static & dynamic priority

Yes

No

High priority

Yes

Yes

Real time priority

Yes

Yes

Kernel thread priority

No

Yes

Completely fair scheduler CFS

Yes

no

First in first out FIFO

Yes

Yes

Round robin

Yes

Yes

Total priority range

0-139

0-127

Lowest to highest priority range

0-39

0-63

System reserved thread priority range

64-95

Real time priority range

40-139

96-127

 

5.1 Android Processes and threads scheduling

Scheduling in android is
done according to priorities of process. Priorities defines that which process
take how much of the Central Processing Unit (CPU) time. The range of
priorities are from 0 to 139. There are three types of priorities, first one is
static priority. This is the default and lowest priority of newly created
thread. Second one is the dynamic priority. When processes or thread don’t get
enough CPU time and they start starving because of higher priority thread take
all the CPU time then dynamic priority comes to action. In dynamic priority,
priorities of those processes and threads are raised which are starving. It is
called dynamic because priorities are keep on changing (lower and higher) in
this. Both static and dynamic priorities range from 0 to 39. The third priority
is Real Time priority in this priority all the real time processes are
scheduled under a scheduling policy. Which are Round robin (RR) and First in
first out (FIFO). Real time priority weight more than in comparison to static
and dynamic priority. Real time priority range start from 40 to 139. In Linux
2.6.23 a new scheduling policy was introduced that is Completely Fair Scheduler
CFS. In this scheduling policy those process gets CPU first which receive least
CPU so far.

5.2 iOS Processes and threads Scheduling

Scheduling in iOS is also
based upon priorities, likewise in android. In iOS there are four type of priorities.
Range for those priorities start from 0 to 127. First priority is normal
priority. Second priority is high priority. This is the priority which is a
little bit higher than normal. Both priority range start from 0 to 63. The
third priority is system reserved kernel thread priorities. The range reserved
for this priority start from 64 to 95. In this range only system threads and
process executed higher than every user applications threads. The fourth
priority is Real Time priority range start from 96 to 127. Real time process
example in mobile Operating system is like music application. The scheduling
policy in iOS is Round Robin (RR) and first in first out (FIFO). There is
another scheduling policy SCHED_OTHER (system Specific policy).

 

 

 

 

 

 

 

 

6. Interrupt Handling

 

Android

iOS

Interrupt handling support

Yes

Yes

Interrupt priorities

Yes

Yes

Interrupt controller

Yes

Yes

Interrupt request lines IRQs

Yes

yes

Interrupt service routine ISR

Yes

No

Inter process routines

Yes

yes

Hardware Interrupt support

Yes

yes

Software interrupt support

Yes

Yes

Maskable Interrupt

Yes

Yes

Non maskable interrupt

Yes

Yes

Software traps

Yes

Yes

Hardware traps

Yes

yes

Table 5: Interrupt Handling

 

6.1 Android Interrupt
handling

Android get input from multiple input sources like touch
screens, keyboards, different sensors like accelerometer, GPS etc. Android
operating system support interrupt handling and handle interrupts very
efficiently. Android provides a stack structure. Which gets input from device
driver at kernel level. After that covert that raw data of input in high level
input like gesture, posture, press etc. that work done by eventhub in android
which converts low level raw input data to high level input. There are two more
component to process input like inputReader and inputDispatcher. The event of
input always occur when there is interrupt occur. That interrupt is generated
by headphone jack, touch etc. device detect that low level interrupt which is
converted to electric pulse. That current pulse is converted into a interrupt
and send towards CPU via Interrupt handler. The path through which interrupts
are travels are called Interrupt request Lines IRQs. As android forked from Linux,
Linux provide a mechanism as a default interrupt handler. Device driver
generate interrupt that mechanism or function checks that any device drive
generated interrupted or not. All the interrupt travel through interrupt
request lines IRQs. Every interrupt travel through their corresponding (IRQs)
of device drivers but some time IRQs are shared among different device drivers.
When a driver use a interrupt request lines IRQs there is a call back function
generated to interrupt service routine (ISR). Android also efficiently handle
hardware and software interrupts. Hardware interrupt like by plugin audio jack
which cause hardware interrupt. Software interrupt like receiving a call while
playing a music file which cause audio interruption. There are both maskable
interrupts and non maskable interrupts in Linux based android operating system.
Sometime android system get into traps like software and hardware traps.

 

7. Device Drivers

 

 

 

Refrences

15.

NCSU, (2014): “Mobile Operating System” available at

http://www.csc.ncsu.edu/ faculty/ healey/csc563

/notes/ch-06.pdf

 

20.

Renner T. (2014): “Mobile OS – Features, Concepts and

Challenges for Enterprise Environments” SNET Project

Technische Universit ?at Berlin

 

3.

CMER, (2014): “Mobile Operating System” Centre for

Mobile Education and Research

 

Gartner (2010): “Gartner Says Worldwide Mobile Phone

Sales Grew 35 Percent in Third Quarter 2010;

Smartphone Sales Increased 96 Percent” Gartner, Inc.

available at http://www.gartner.com/it/ page.jsp?id=

1466313

 

 

 

x

Hi!
I'm Mary!

Would you like to get a custom essay? How about receiving a customized one?

Check it out