1. IntroductionMobile phones becomes a basic necessity of our digital world.First computer and now smart mobile phones revolutionize our every aspect oflife. Modern smartphones are closer to handheld computers that enable us to performmany task like make video calls, photography, mailing, watch videos, socialmedia, perform banking tasks and much more besides. A Mobile operating system(OS) is a software which controls and drive all the components of a mobilehardware. A mobile operating system. System is an OS built exclusively for amobile device such as smartphone, tablet or other embedded mobile OS.
Now a day’smost popular mobile operating systems are Android and iOS.1.1 Android VS iOSAndroid and iOS are the two top most leading Mobile operatingsystem in the world.
Android is launched by Google Inc. initial release was on23rd September 2008(9 years ago) basically designed for touch screenmobiles devices later than also developed for Android TV, android auto andAndroid wear, iOS is launched by Apple Inc. initial release of iOS was on 29thJune 2007(10 years ago) for iPhone, iPad, iPod.
Both Operating systems are muchfast, secure and reliable.Now a days 99% mobile devices arepowered by android and iOS so the market is also occupied by these two of OperatingSystems. According to recent stats 85% market share is occupied by Google Android14% by Apple IPhone iOS and 1% by others mobile operating system. According to officialPress releases of Google and Apple which states that over 2 billion androiddevices are monthly active and over one billion iOS devices active worldwide.In this paper we are going to providea comparison between android and iOS at operating systems level. Such that howthings are handled in these two Operating systems 1.1 Kernel:Both Android and iOS are forked from existing Operatingsystems. Android is based on Linux kernel LTS (long-term support) branches, writtenin java, C and C++.
Since android run on a modified Linux kernel it have a monolithicstyle of kernel. Android is an open source mobile operating system by having an Open Source software program, Google allowdevelopers to alter large amounts of the code to their own preference.On the other hand iOS is based on Darwin (BSD) and macOSforked from UNIX operating system. Written in C, C++, objective-C and swift.iOS have a hybrid style of kernel (XNU) containing features of both micro kernels. iOS is a closed source mobile OS appledon’t allow developers to change anything that deals with the operating systemitself2. Process and Thread ManagementTable 1: process andthread 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 andThread Management In Android Operating system when a new application startrunning, system create and start a new process for that application with only asingle thread of execution.
There is a main thread in every application whichis known as User Interface (UI) thread. Basically every thread, component andparts of the application work under this UI thread. Every process is made up ofmore than one threads. Some thread run dependently and some independentlydepending upon the application. Each and every thread always remain inside ofthe process virtual memory and address space of the process.
If a newapplication need to start and there is not enough space in the memory then androidforcefully shut down the process according to their importance to create spacefor new process. There is a hierarchy of processes to determine which processwill be killed first or last while system is low on memory, in android hierarchyis like this form high to low. Foreground process, visible process, serviceprocess, background process & empty process. The list is based on”importance hierarchy”.
It mean importance of first process is high so it willbe killed at last while last one killed first. There are different states of aprocess. 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/Ooperations for their proper working.2.2 iOS Process andThread ManagementiOS also create and start a new process for application whichis newly start with a single thread of execution. Every process is made up ofmore than one thread and there is main thread which control the mainfunctionality of the application. Every thread can perform I/O operation. whena new thread created inside main thread that thread run independently insidethe same virtual memory and address space of process. .
If a new applicationneed to start and there is not enough space in the memory then iOS forcefullyshut down the process according to their importance to create space for newprocess. There is a hierarchy of processes to determine which process will bekilled first or last while system is low on memory. The hierarchy is same like thishigh 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 highso it will be killed at last while last one killed first.
There are differentstates of a process, in iOS states of process are, not running, active,inactive, background & suspended. In iOS two techniques are used for IPCwhich is Grand central dispatch and pasteboard.3.
Memory ManagementMemory management is a very important aspect of every modernoperating system. Mobile operating systems like android and iOS handle and managememory very efficiently. 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 MemoryManagementAndroid use memory mapping and paging to handle memoryproblems. Page size is of 4kb. Any application old or new can’t be removed frommemory and remain in the main memory until that application releases the objectreferences it holds and making the occupied memory available for GarbageCollector (GC) to Clean. Inside a managed memory environment like in androidsystem keep track of its memory allocation. The technique of reclaiming unusedmemory from application after determining that a piece of memory is no longerused by any application is called garbage cleaning.
There are two goals of aGC. Finding those type of data object which are not accessed in future andreclaiming the memory used by those data objects. Android memory isgenerational type of memory. In generational memory there are three type ofgeneration young generation, old generation and permanent generation. The newlycreated object stays in young generation.
When an object lives long then thatobject transfer to older generation. Young and old generation are furtherdivided into to Eden and survivor space generation, tenured generation.Permanent generation is a generation where classes of java and method objectresides in it. GC of java works at runtime. In generational memory everygeneration has it own upper limit that when will garbage collector start andhow long it remain active for cleaning and how many data object remain in ageneration.
3.2 iOS memorymanagementiOS support full time virtual memory environment. Page sizeis same as android 4kb but some hardware support 16kb of page size. MAC OSX usesgarbage collector of objective C rather than iOS based on MAC OSX it don’t useGC for memory cleaning. It uses another technique which is known as AutomaticReference counter (ARC).
The main methods of ARC are retain and release andthese methods are inserted in code at compile time. In ARC when an object iscreated or copy of object is created it’s retain count become 1. When any otherobject shows an ownership interest in a object its retain count increases to 2and whenever owner releases it ownership its retain count reduced by 1. Whenthe retain count become zero the object is destroyed. There is a auto releasepool when an object is placed in this then that object is release after theprogram execution exits beyond the scope. There is a method auto deallocationwhen retain count of a object becomes zero the deallocation method is call to reclaimthe resource. iOS applications voluntarily free up memory for anotherapplications.
4. Virtual MemoryAndroid and iOS both support full time virtual memoryenvironment comparison of both OS virtual memory is give below 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 VirtualmemoryAndroid support virtual memory and use memory mapping andpaging to implement virtual memory. Page size is of 4 kb. Two types of addressesare generated in virtual memory one is physical address and other is virtualaddress. When system is low on memory android kill the apps according topriorities but don’t support swapping of apps to secondary memory from mainmemory. In android every process remains in its own separate logical address.
4.2 iOS virtual memory iOS also support virtual memory and use memory mapping andpaging to implement Virtual Memory. Page size is of 4kb but in some hardwaresupport 16kb page size. Two type of address are generated in this virtualmemory one is physical address and other is virtual address. When system is lowon memory iOS kill the apps according to priorities but also support swappingof apps to secondary memory from main memory to free up memory for new apps. IniOS every process remains in its own separate logical address.
5. Processes and threads 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 schedulingScheduling in android isdone according to priorities of process. Priorities defines that which processtake how much of the Central Processing Unit (CPU) time. The range ofpriorities are from 0 to 139. There are three types of priorities, first one isstatic priority.
This is the default and lowest priority of newly createdthread. Second one is the dynamic priority. When processes or thread don’t getenough CPU time and they start starving because of higher priority thread takeall the CPU time then dynamic priority comes to action. In dynamic priority,priorities of those processes and threads are raised which are starving. It iscalled dynamic because priorities are keep on changing (lower and higher) inthis.
Both static and dynamic priorities range from 0 to 39. The third priorityis Real Time priority in this priority all the real time processes arescheduled under a scheduling policy. Which are Round robin (RR) and First infirst out (FIFO). Real time priority weight more than in comparison to staticand dynamic priority.
Real time priority range start from 40 to 139. In Linux2.6.
23 a new scheduling policy was introduced that is Completely Fair SchedulerCFS. In this scheduling policy those process gets CPU first which receive leastCPU so far.5.2 iOS Processes and threads SchedulingScheduling in iOS is alsobased 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 normalpriority. Second priority is high priority. This is the priority which is alittle bit higher than normal. Both priority range start from 0 to 63.
Thethird priority is system reserved kernel thread priorities. The range reservedfor this priority start from 64 to 95. In this range only system threads andprocess executed higher than every user applications threads. The fourthpriority is Real Time priority range start from 96 to 127. Real time processexample in mobile Operating system is like music application. The schedulingpolicy in iOS is Round Robin (RR) and first in first out (FIFO).
There isanother 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 6.
1 Android InterrupthandlingAndroid get input from multiple input sources like touchscreens, keyboards, different sensors like accelerometer, GPS etc. Androidoperating system support interrupt handling and handle interrupts veryefficiently. Android provides a stack structure. Which gets input from devicedriver at kernel level. After that covert that raw data of input in high levelinput like gesture, posture, press etc. that work done by eventhub in androidwhich converts low level raw input data to high level input.
There are two morecomponent to process input like inputReader and inputDispatcher. The event ofinput always occur when there is interrupt occur. That interrupt is generatedby headphone jack, touch etc. device detect that low level interrupt which isconverted to electric pulse. That current pulse is converted into a interruptand send towards CPU via Interrupt handler.
The path through which interruptsare travels are called Interrupt request Lines IRQs.