Book
  • Introduction
  • Welcome !!
  • Chapter 1: The mobile ecosystem
    • Fragmentation is the devil
    • There is more than one type of mobile app
    • ... more than one type of app
    • ... one type of app
    • Under pressure (ee da de da de) !!
    • Further reading!!
  • Chapter 2: Let's start with design thinking
    • A taste of design thinking
    • The five steps
    • Design for everybody
    • Accessibility in mobile apps
  • Chapter 3: Give me a context and I will give you an app
    • Users
    • Personas? Users ? What is the difference?
    • Please, help me to model the context
    • The context canvas
  • Chapter 4: Powerful models
    • Data architecture is the foundation of analytics
    • From data to information and knowledge
    • Information/Knowledge in our mobile ecosystem
    • Questions to ask yourselves when building and classifying questions
    • The visualization-data map
    • On the scene: describing how personas interact with your app
  • Chapter 5: A GUI is better than two thousand words
    • 'Good to Go:' Let's explore the Design Systems
    • Designing GUI Mocks
    • No prototype... no deal
  • Chapter 6: About mobile operating systems ... and other deamons
    • The Android OS ... son of LINUX
    • iOS son of Darwin? or is it iOS son of UNIX?
    • Kernels
  • Chapter 7: Yes, software architecture matters !!
    • Self-test time
    • About design and design constraints
    • Architects' mojo: styles and patterns
    • What you need is a tactic !!
    • Self-test time 2 (for real)
    • Further reading
  • Chapter 8: Finally... coding
    • MVC, MVVM, MV*, MV...What?
    • Programming models: the Android side
    • Hello Jetpack, my new friend... An Android Jetpack Introduction
    • Programming models: the iOS side
    • Controllers and more controllers
    • Flutter son of... simplicity
    • Programming models: Flutter?
    • Flutter: State matters... Let´s start simple
    • Flutter: State matters... Complex stuff ahead
    • Micro-optimizations
  • Chapter 9: Data pipeline
    • Generalities data pipelines
    • Data storage types
    • Types of data pipelines
  • Chapter 10: Error Retrieving Chapter 10
    • Eventual Connectivity on Mobile Apps
    • How to handle it on Android
  • Chapter 11: The jewel in the crown: Performance
    • As fast as a nail
    • Memory bloats
    • Energy leaks
    • Final thoughts
  • Chapter 12. Become a performance bugs exterminator
    • Weak or strong?
    • Micro-optimizations
    • The single thread game !!
    • Using multi-threading like a boss !!
    • Caching
    • Avoiding memory bloats
    • Further readings
Powered by GitBook
On this page
  1. Chapter 6: About mobile operating systems ... and other deamons

iOS son of Darwin? or is it iOS son of UNIX?

PreviousThe Android OS ... son of LINUXNextKernels

Last updated 1 year ago

(By Mario Linares-VĂ¡squez)


iOS is the operating system designed by Apple for its iPhone and iPad devices. watchOS is the OS for the Apple watch devices. iOS is a kind of brother of Mac OS X (the OS for the laptops) because both have as origin the Darwin OS -- an open source OS- -- that was derived from NextStep. In reality, iOS is the same Mac OS X but with changes in memory management, kernel compilation, and the system GUI, among others.

The first version of iOS was released in 2007.

If an iOS app can use any of the Application or Core frameworks, why are the sublayers (cocoa, media, services, core os) organized as a stack? Because each sublayer provides a different abstraction level, i.e., the upper in the stack, the higher the abstraction level provided to the developers and the lesser low-level programming is required; the lower in the stack, the closer to the hardware the API is. Some of the frameworks' upper layers rely on the frameworks' lower layers. Remember that a developer can use any of the frameworks, independently of how close it is to the top of the stack.

A brief description of the iOS layers are the following:

  • User experience: is the iOS user interface and the applications the user interacts with. The dashboard, spotlight, spring board (i.e., the home screen manager) are components of this layer.

  • Cocoa touch: contains the key frameworks required to build an iOS app. The frameworks are mostly written in Objective-C.

  • Core OS - Frameworks: low level features and services required by the upper layers, such as image processing, linear algebra, complex and big numbers, networking, memory management, file system, threads, authentication, sensors.

iOS has a hybrid open source kernel called XNU (X is Not Unix); XNU combines the Mach microkernel developed by Carnegie Mellon University (CMU) with components from the 4.3BSD monolitic kernel. The XNU kernel is part of the Darwin layer in iOS and MacOS X. It is worth noting here that Darwin is the only Open Source part of iOS.

Dude, but what is micro-kernel and a momolithic one?

To understand the differences between monolithic and microkernels you must understand the difference between user and kernel modes/spaces first. Kernel space is the memory region where kernel processes run, and user space is the memory region when user processes run. In a monolithic kernel, user and kernel processes run in the same memory space and the kernel is a single static binary file; therefore, the kernel is bigger but faster because everything runs as a single large process in the the same address space (i.e., kernel space) . However, if there is a crash in a service then the entire system will fail. Note that it does not mean that the OS can not be extended because it is a static binary file; monolithic kernels are dinamycally extended with loadable kernel modules that implement interfaces in the kernel. This feature opens a door for security issues because dynamic modules (e.g., the ones created by OEMs) run in the kernel space with full access to the resources of the computer. LINUX and UNIX are examples of monolithic kernels.

In the case of microkernel, the different modules are executed in different space addresses; some of the modules are executed in kernel space, some others are executed in user mode. Because of the separation, the kernel is more robust and services can crash without taking down the whole system. Micokernels are more extensible than monolithic kernels because the modules running on user space can be modified without restarting the kernel. An example of micro-kernel is Mach.

If you are interested on going deeper into the internals of the Android OS and iOS, we recommend you to read the "Android Hacker's Handbook" by Drake et al. and the "Mac OS X and iOS Internals" book by Jonathan Levin.

Do you have a mac? Type the uname -acommand in the terminal.

__

The internals of iOS are very interesting and complex. The figure at the beginning of the section depicts two abstraction levels of the iOS stack where each one of the boxes to the right has is own set of subsystems. iOS is similar to Android because both have a software stack built on top of a kernel, however, the apps programming models are very different (from the point of view of the OS stack). For instance, in the case of Android, the apps use the Android API to invoke the services and managers in the Android Framework layer. In the case of iOS, the apps can use any of the "frameworks" available in the Application and Core frameworks layers (i.e., any framework in the Cocoa Touch, Media, Core Services, and Core OS layers). A framework in iOS is a bundle, i.e., a set of libraries and their corresponding files. For example, the Cocoa touch layer includes the , and frameworks, and the Media layer has the , , and frameworks.

Media: frameworks for graphics, audio and video. Provide multimedia-related capabilities to iOS apps. The Media layer includes libraries such as , OpenGL, , Open AL, and .

: provide access to system services, low-level routines, models, collections and data types, and wrappers (e.g., the Foundation framework has wrappers for the Core Foundation framework).

UIKit
EventKit
GameKit
SceneKit
SpriteKit
CoreGraphics
Quartz
Metal
Media Player
Core Services