Unit 4
Unit 4
4.0 Introduction
4.1 Objectives
4.2 Features of iOS
4.3 Evolution of iOS
4.4 Architecture of iOS
4.5 iOS Kernel Architecture
4.6 Processes and Threads Management
4.6.1 Threading Packages
4.6.2 Threads Alternatives
4.7 Memory Management
4.7.1 Application Memory Management
4.7.2 Virtual Memory Management
4.7.3 Page List in Kernel
4.7.4 Page Fault
4.8 File System in iOS
4.8.1 iOS Directories
4.8.2 iCloud Container
4.8.3 Identification of File Type
4.8.4 Security of File System
4.9 Summary
4.10 Solutions / Answers
4.11 Further Readings
4.0 INTRODUCTION
iPhone operating system (iOS) is a mobile operating system developed by Apple Inc.
used for apple handheld devices. It is used in devices like- iPhone, iPad and iPod. It is
the second most widely used mobile operating system. It supports features like direct
manipulation and can respond to various types of user gestures. It is proprietary and
closed source and derived from macOS. Software development kit (SDK) is provided
to create applications. It includes interfaces for developing, running and testing
applications. Apps can be written using system frameworks and Objective-C
programming language.
Initial three versions were introduced with the name iPhone OS. From fourth version,
they renamed it to iOS. With each new version, new features and apps were added.
iOS 13 is latest version which was released in 2019. Its major feature is dark mode
and new Map application with street view capability. It also enhanced its previous
apps and features like-Siri, Heath map and others. iOS 14 is about to release in
2020. 63
Case Studies
4.1 OBJECTIVES
After going through this unit, you should be able to:
Understand the basic functions of iOS Operating System
Know the history of iOS operating system
Understand the process management in iOS and can compare with other OS
Understand the memory management approaches in iOS
Understand the File management in iOS
Understand the security features in iOS
4..4.1 Coree OS
It is the lowest layer
l in the iO
OS architecturre hence respoonsible for prroviding basicc low
levvel features. The
T framewoorks present inn this layer aree:
Securiity services frramework
Autheentication fraamework
Bluetoooth framewo
ork
Externnal accessory
y framework
Accelerate framew
work
Fig
F 2: XNU keernel Architectture
(Source: deveeloper.apple.coom)
4.7 MEMORYMANAGEMENT
For effective and efficient utilization of memory, memory management is required by
the iOS. Resource needs to be free up when they are not required. In iOS memory
used by applications is managed by maintaining the life cycle of objects and freeing
them when not required. To identify that an object is no more required; its object graph
is created. The group of objects that are related to each other forms object graph. In
this, objects can be related by the direct reference or indirect reference.
Fig
g3: Difference between
b Autom matic and Man nual Reference Counting
(Source: devveloper.apple.ccom)
Memory
M management usinng Reference counting is based b on Ownnership of object. An
object
o can be owned by one or many owners.o Thee object contiinues to existt till the
tiime it has atleeast one owneer. The objectt is destroyed automaticallyy at runtime iff has no
owner.
o Hencee, ownership is the ability of causing obbject to be destroyed.
a.
a Referencce Count Model
Memory
M is maanaged by maaintaining lifefe cycle of an object. Whenn the objects are not
needed,
n it shoould be de-allocated. Whhen an object is created or o copied, itss retain
count
c is set to 1.
1 This retainn count can inccreasewith tim
me if ownership
p interest is exxpressed
by
b other objeccts. The retainn count can alsoa be decrem mented if objjects relinquish their
in
nterest of owwnership. The object will be maintainedd in memory tiill it’s retain countc is
not
n zero. The object will bee deallocatedd once it’s retaain count reaches zero.
Fig
F 4: Reference Counting Model
M (Source: developer.applle.com)
b.
b Automattic Reference Counting
Automatic
A refference countting is a comppiler provideed feature thatt manages meemory
automatically
a of
o Object-C oobjects. Auto omatic referennce counting is
i an ownersship
72 syystem which provides connvention for management
m and transferr of ownershiip. It
the object’s lifetime requirements and user need not to remember about retain and Case Study – iOS
releases. It allows object to be pointed by two types of references- strong and week.
An object which is strongly referenced will be preserved and never deleted. The objects
having back reference is called weak reference and can be de-allocated (destroyed).
When no strong reference to objects is left, the object automatically becomes nil.
Hence weak reference does not increase life time of objects. This model also imposes
some restricts to prevent memory faults or issues.
4.8
4 FILE
E MANAG
GEMEN
NT SYSTE
EM
Storage
S of datta, files, applications, opeerating system
m files is mannaged by file system.
s
The
T default fiile system useed in iOS is APFS
A for verrsions after iO
OS 10.3. Befo
fore this
HFS+
H was deffault file systtem. In iOS user cannot acccess file systtem directly but
b they
can
c access it using
u applicatiions.
4.8.1
4 iOS Directoriies
Applications
A c interact with
can w file systeem only its saandbox directtory. When thhe apps
are
a installed, various
v contaainer directorries are creatted in its sanddbox directoryy. Here
every
e containner is created for a specificc role. There aare two main n containers ––bundle
container
c and data containeer. Data contaainer is furtheer divided into o subdirectoriies used
too organize appp’s data. Inn addition to theses contaainers, apps can c also requuest for
additional
a conntainers exampple iCloud coontainer.
F
Fig5: Sandbox directory of iOOSApp
74 (Source: devveloper.apple.com)
Files outside these containers are generally restricted for use by applications. Use of Case Study – iOS
public system interfaces like contacts and music is exception to this rule.System
framework in this case uses helper apps to perform file operations by modifying or
reading from appropriate data storage locations.
Some of the commonly used directories in iOS sandbox are –
(i) Appname.app
This directory is created during app’s installation. It contains the app’s
executable data and resources. User should not write to this directory because
app may not launch due to change in signature. However, user can get read
only access to app’s bundle data.
(ii) Documents/
Data generated by user is stored in this directory. Files present in this directory
can be accessed by user using file sharing. This directory is also backed up by
iCloud and iTune.
(iii) Documents/Inbox
It is a subdirectory within Documents which is required by apps to open files
asked by outside entities. Apps can read and delete data from this directory
but cannot modify and create new files. Generally email attachments related
to apps are placed in this directory by mail program. This directory is also
backed up by iCloud and iTune.
(iv) Library/
This subdirectory is used to store data which is not required to be exposed to
user. It contains applications support, preferences and cache subdirectories
for iOS apps. Custom subdirectories can also be created by user but should
not be used for user data.This directory is placed in data bundle. Except
cache all the contents of this directory are also backed up.
(v) tmp/
This directory is used to store temporary file i.e. files that are not needed to
persist. These file must be deleted by the apps when they are not needed.
When apps arenot running, systemmaydelete thesesfiles. Datain this directory
is not backed up.
For proper organization of files, additional subdirectories can be created within
Documents, tmp and Library by iOS apps.
Check Your Progress 1
1) Describe the important features of iOS 14.4 version.
........................................................................................................................
........................................................................................................................
........................................................................................................................
........................................................................................................................
4.9 SUMMARY
In this unit we had studied iOS operating system. iOS is a mobile operating system
developed byApple Inc for iPhone.Adescription of howprocess management, memory
management, file management, security in iOS is discussed in this unit. Along with
various functions of the iOS operating system, its evolution, architecture, and other
features were described.
In this course we had studied Operating Systems in general and 4 case studies.
78