Android vs. iOS system architecture Layer

Source: Internet
Author: User
Tags posix sqlite
1. Introduction

Since the iphone's debut in 07 to bring smartphones directly to the mobile internet era, smartphone penetration has soared, while the entire market is now showing a two-strong rivalry between the iphone and the Android phone.

iOS is a handheld device operating system developed by Apple. Originally designed for the iphone, it was later applied to Apple products such as the ipod Touch, the ipad and Apple TV. It is also based on Darwin, and therefore belongs to UNIX-like commercial operating systems.

Android is a Linux based open source operating system that is primarily used in portable devices. The Android operating system was originally developed by Andy Rubin, which initially supported mobile phones. The 2005 injection of Google, and a number of manufacturers to create an open Handset Alliance development and improvement, and gradually expanded to the tablet computer and other areas. So far, Android has leapt into the world's most popular smartphone platform.

In the area of portable devices, the advantages and disadvantages of iOS and Android are becoming increasingly apparent. 2. Android vs. iOS system architecture 2.1 Android system Architecture

The Android architecture is a four-tier architecture, from the top to the bottom, the application layer, the application framework layer, the System runtime layer, and the Linux kernel layer, as described in Figure 2.1, respectively:



1) Application layer

The Android platform is not just an operating system, it also contains many applications, such as SMS client programs, Phone Dialer, picture browsers, Web browsers, and more. These applications are written in the Java language and are replaced by other applications developed by developers, which are different from the system software that is solidified within the system by other mobile operating systems, and are more flexible and personalized.

2 application Framework layer

The application framework layer is the foundation on which we engage in Android development, and many core applications implement its core functionality through this layer, which simplifies the reuse of components, allows developers to use the components they provide for rapid application development, and enables personalized expansion through inheritance.

A) Activities Manager (activity Manager)

Manage the lifecycle of individual applications and the usual navigational fallback functionality

b) Window Manager (window manager)

Manage all the window programs

c) Content Provider (content provider)

Enables access or sharing of data between different applications

d) View system (view systems)

Building the basic components of an application

e) Notification Manager (Notification Manager)

Enables applications to display custom hints in the status bar

f) Package Manager (Package Manager)

Program management within the Android system

g) Telephony Manager (phone manager)

Manage all mobile device features

h) Resource Manager (Resource Manager)

Provides a variety of non-code resources used by applications, such as localized strings, pictures, layout files, color files, and so on

i) Location Manager (location manager)

Provide location services

j) XMPP Service (XMPP services)

Provide Google Talk services

3) system running library layer

As you can see from the diagram, the System runtime layer can be divided into two parts, the system library and the Android runtime, respectively, as described below:

A) System library

The system library is the support of the application framework and is an important link between the application framework layer and the Linux kernel layer. It is mainly divided into the following several:

Surface Manager:

When executing multiple applications, it is responsible for managing the interaction between display and access operations, and also for 2D drawings and 3D drawings for display synthesis.

Media Framework:

Multimedia library, based on PacketVideo Opencore, supports a variety of commonly used audio, video format recording and playback, encoding format includes MPEG4, MP3, H.264, AAC, ARM.

Sqlite:

A small relational database engine

opengl| Es:

3D drawing function library based on OpenGL ES 1.0API Standard

FreeType:

To provide the description and display of lattice words and vector words

Webkit:

A set of web browser software engine

SGL:

The underlying 2D graphics Rendering engine

Ssl:

Handshake in the communication process on Andorid

LIBC:

Standard C system function library from BSD inheritance, tailored for embedded Linux based devices

b Android Runtime

The android application is written in the Java language, and the program executes in the Android runtime, which runs as the core library and the Dalvik virtual machine in two parts.

Core library:

The core library provides most of the functionality in the Java language API and includes some of the core APIs for Android, such as Android.os, Android.net, Android.media, and so on.

Dalvik Virtual machine:

Android is different from the J2ME program, each Android application has a proprietary process, and not many programs run in a virtual machine, but each Android program has an instance of a Dalivik virtual machine and executes it in that instance. The Dalvik virtual machine is a register based Java virtual machine, rather than a traditional stack based virtual machine, and is optimized for memory resource usage and supports multiple virtual machines. It should be noted that the Android program does not perform the compiled bytecode in the virtual machine, but instead converts the Java bytecode into a DEX-formatted middle code through the conversion tool DX.

4Linux kernel layer

Android is based on the Linux2.6 kernel, and its core system services such as security, memory management, process management, network protocols, and drive models all depend on the Linux kernel.

Android Kernel Analysis

The status of the kernel in the operating system Android is based on a Linux operating system composed of four parts, hardware, system kernel, system services and applications. The kernel is the core part, its main function is to interact with the computer hardware to implement the hardware programming control and interface operation scheduling access to hardware resources at the same time to the application to provide an advanced execution environment and the virtual interface to the hardware. The main features include interrupt service program, Process Scheduler, memory management of process address space, and interprocess communication. Unlike a normal application, the kernel has access to all hardware devices and a protected memory space that is split at startup.

Second, the Android kernel and the standard Linux kernel, the main implementation of the Android kernel memory management, process scheduling, inter-process communication and other functions. The Android kernel is modified on the basis of the standard Linux kernel. In order to adapt to the embedded hardware environment and the development of mobile applications Android has made some modifications to the standard Linux kernel. A detailed comparison with the standard Linux kernel source code shows that the Android kernel differs from the standard Linux kernel in file systems, interprocess communication mechanisms, memory management, and so on.

File systems are different from desktop systems and servers  mobile devices use flash as storage media rather than hard disks, so the Android kernel adds YAFFS2 file systems that are not accepted in the standard Linux kernel. YAFFS2 by hierarchy design  divided into file management interface, internal implementation layer and NAND simplifies its own interface with the system design can be more easily integrated into the system.

Inter-process communication mechanism Android adds a interprocess communication mechanism ipcbinder,binder the data exchange between processes by servicemanager the services in the management system through the daemon process. Each process accesses the same piece of shared memory through binder to achieve the data communication mechanism. From the perspective of the application layer, the process obtains the program framework interface for data exchange through accessing the data daemon, invokes and shares the data through the interface, and other processes need to access the data only to interact with the program framework interface to facilitate the programmer to develop applications that require interactive data.

Memory management in the memory management module The Android kernel employs a low memory management strategy that does not apply to the standard Linux kernel. A low memory management strategy called OOM (OutOfMemory) is used in the standard Linux kernel to shut down the process when the system checks all processes and restricts the process to the highest score when there is not enough memory. Android adds a memory-sharing approach to ASHMEM. Sharing a named memory block between Ashmem processes anonymously is not supported in standard Linux. The analysis of the Android kernel is modified by the standard Linux kernel, so inheriting the advantages of the Linux kernel preserves the main architecture of the standard Linux kernel. At the same time, Android in accordance with the needs of mobile devices in the file system, memory management, interprocess communication mechanism, power management and other aspects of the modification to add relevant drivers and some of the necessary new features, But compared to most of the streamlined embedded Linux operating systems, Android largely retains the basic infrastructure of standard Linux, so the Android system is more widely expanded.

2.2 iOS System Architecture

The system architecture of iOS is divided into four levels: core operating system layer (Cores OS layer), Core service layer (Cores services layer), media layer (medium layer) and touch layer (Cocoa touches layer), see Figure 2.2.



1. Core OS:
Darwin, which was rewritten with FreeBSD and Mach, is an open-source, POSIX compliant UNIX core. This layer contains or provides some basic functionality for the entire iphone OS, for example: Hardware drivers, memory management, program management, thread Management (POSIX), File systems, networks (BSD sockets), and standard input and output, and so on, all of these functions are provided through the C language API. In addition, it is worth noting that this layer is the most Unix-colored, and if you need to migrate the programs developed on UNIX to the iphone, most of the core OS APIs will be used.
The core OS layer driver also provides the interface between the hardware and the system framework. However, due to security considerations, only a limited system framework class can access the kernel and drive.

2. Core Services:
Core Services provides richer functionality based on the core OS, which includes foundation.framework and core Foundation.framework, called Foundation, This is because it provides a set of basic functions for handling strings, permutations, combinations, calendars, time, and so on. Foundation is a objective-c Api,core Fundation is an API that belongs to C. In addition, the core servieces also provides other functions, such as:
Security, Core Location, SQLite, and Address Book. Security is used to deal with authentication, password management, safety management, Core location is used to deal with GPS positioning, Sqllite is a lightweight database, and addressbook is used to process phone book information.

3. Media

The media layer provides multimedia features such as pictures, music, movies, and so on. The image is divided into 2D images and 3D images, the former is supported by quartz2d, while the latter is opengles. The modules corresponding to the music are core audio and OpenAL, Media player implements the playback of the movie, and finally provides the core Animation to support the powerful animation.

4. Cocoa Touch

The top layer is the cocoa touch, which is the Objective-c API, the core of which is uikit.framework, the various components of the application interface, all of which provide rendering, and in addition it handles the Multi-Touch events on the screen, and the output of the text , pictures, Web page display, camera or file access, and acceleration sensing parts. 2.3 Android vs. iOS on the system architecture:

Android uses Java technology, all applications run in Dalvik virtual machines, and Dalvik is the Java virtual machine that Google specifically optimizes for mobile devices. Therefore, Android is mature, there are a lot of reusable code advantages, but also a large memory, the operation speed slightly lower shortcomings. Apple iOS is relatively traditional architecture, but high efficiency, low hardware requirements, high cost advantages, under the existing hardware conditions, the application of the operation has the best smooth sense, but also more power saving. System architecture is simple, but clean and clear, is currently the most efficient mobile device operating system.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.