Mac Os X Design And Architecture Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Apple Inc. is one of the famous names in computer market who has been also popular in manufacturing and developing a series/line of different graphical operating systems besides other different hardware and software products. Among these graphical operating systems, Mac OS X is the most recent and the most developed and widely accepted one. The main difference between the early developments of Macintosh operating systems and OS X is that latter is UNIX based while formers were not. [1]


If traced back, Apple Inc. brought forward to the computer market its first Macintosh personal computer 28 years ago (in 1984). Their operating systems i.e. Macintosh operating systems, were later seen including different bundles and frameworks. [7] As the Mac operating system evolves, the naming conventions also saw new directions. Earlier systems are known as 'System Software' or just the 'Systems'. [2] System Software of Apple Inc. saw seven different evolution phases or stages and the evolved systems were given the names of System 1, System 2, System 3, and so on. Analyzing these very earlier systems, first four phases (System 1, 2, 3, and 4) had the capability to operate on only one task. Such systems are generally categorized as uni-tasking systems. They are simple systems and do not involve complex process and memory management techniques or even scheduling methods. The file system these systems deployed was the Mac File System (MFS). In later developments, MFS was replaced with Hierarchical File System (HFS). [7] Apple Inc. deployed multitasking features in their developments after System 4. System Software 5, thus, was the first Mac OS that operated on more than one task, which were also cooperative and synchronized. Scheduling techniques were introduced. Memory and process management strategies became complex and enhanced. Although, this evolved version lacked certain features like stability, steadiness, and durability and reliability, System Software 6 fixed all these issues too. Next step was a system with an effective user interface (UI), support for newer applications and improvements/enhancements to system's stability. System 7 was then the last 'System Software' that handled all such improvements along with many other as well. After System 7, Apple Inc. shifted the naming convention of its operating systems from System Software to Mac OS. Mac OS 8 succeeded System Software 7. It included its different versions like 8.1, 8.2, etc. that collectively possessed different improvements like support for Power PC G4 processor, Universal Serial Bus, Hierarchical File System Plus (HFS+) that is an enhancement to the original HFS, Firewire, nanokernel and various multiprocessing services. Mac OS 8 was followed by Mac OS 9 that only tackled and incorporated 'transitional' or makeshift technologies that help integrating earlier versions with the latest versions of the Mac Operating Systems. [3]

The first version of Mac OS X (or OS 10 / OS X) was released in 1999. This release holds different advance features that are briefly discussed in the next sections. Apple Inc. again changed the naming conventions and called different issues of OS X as Cheetah, Puma, Jaguar, Panther, Tiger, Leopard, Snow Leopard, Lion and Mountain Lion.


Mac OS X is the latest development from Apple Inc. and has a number of different releases, each being an enhanced version of its predecessor. It adds value to the earliest operating systems by incorporating in it following main features:



Enhanced networking facilities

Programming edges using object oriented techniques or model

The kernel of OS X provides:


Memory protection


Inter-process communication (IPC)

Sustenance for various types of file systems

Time sharing


XNU is the name given to the kernel of OS X. It is a hybrid or cross kernel [7] that collects features and architectural facets of Mach kernel and Berkeley Software Distribution (BSD - a.k.a. Berkeley Unix). I/O kit is another feature that makes Mac OS X kernel unique and different. With this kit, the XNU kernel manages different device drivers. Like many other operating systems, Mac OS X also encompasses different OS aspects like file system and networking.

Fig. 1. OS X Kernel Architecture

As it is UNIX based, XNU is also an open source. OS X kernel and other components of Mac operating system refer to as 'Darwin'.

Talking about Mach kernel first, it mainly provides 'processor resources management' to the Mac OS X. It includes: [6]

CPU sharing

Memory allocation

Memory protection


Inter process communication

Data sharing


Remote procedural calls (RPC)

Symmetric multiprocessing (SMP)

Virtual memory (VM) management

BSD layer of the kernel area of OS X architecture is based on BSD architecture, chiefly the Free BSD. It has different components that are liable for: [6]

File system



System calls

Process management


Kernel and POSIX APIs

POSIX threads

KEXTs or kernel extensions are another feature of OS X, besides I/O Kit, which is unique and different from many other operating systems. The dynamic loading or runtime loading of the code to the kernel area without having the effort of recompiling it over and over is the responsibility of these extensions. [4]

Supported Hardware Platforms

OS X supports: [10]

x86-64: versions 10.4.7 through 10.8;

IA-32: versions 10.4.4 through 10.6.8;

PowerPC: versions 10.0 through 10.5.8.

Process Management

Programs become processes when they are brought into memory for execution. OS X has different types of processes that cooperate with each other and conjoin. Macintosh OS says that "Everything is a process". The main types of processes in Mac OS X are background processes, foreground processes and suspended processes. Moreover, there are processes with the support of UI and initiated at a specific time slot; while others run only in the background and has no UI (non-interactive processes). [5], [8]

Some commands that are used commonly are 'bg' (background a process), 'fg' (foreground a process), 'kill' (kills a process) and 'top' (statistics of system resources).

Jobs and Processes

Like every Unix system, OS X has also processes that are related to each other. Every process is a child of every other process, called the parent process. This parent-child relationship among different processes can be traced back to the ancestor processes; the init process being the ancestor of all other processes and having no parent of its own.

There are two main types of jobs - shell jobs and user jobs. A job is essentially a collection of different cooperating processes that execute in parallel for a particular task. User jobs belong to different users and are initiated by them. However, shell jobs are group of processes that are invoked by an instant of a shell or another. There is another category of jobs called suspended jobs. These are groups of inactive or non-executing processes.

Process States

Processes can be found in different states during their entire life. These states are:

0 - Running. The CPU is currently executing this process.

1 -Runnable from main memory

2 -Runnable from swap

3 - Sleeping (waiting for I/O) in primary storage

4 - Sleeping (waiting for I/O) in swap space [9]

Fig. 2. Five Process States

Threads and Tasks

There are multiple threads in a single process in Mac OS X. However, Apple considers a "process" a task. A task is an assemblage or a pool of system resources, and can hold various threads. A task has no existence of its personal, however merely happens to enclose threads and offer resources through inheritance. A thread is a point of control in a task, has access to all the elements of the parent task, potentially executes in parallel with other threads in that task. [9]

Fig. 3. Threads


OS X takes in hand different scheduling techniques that include priority based scheduling, preemption, and processor resource allocation centered on timesharing, round robin, and FIFO fixed priority guidelines. It surrounds greatly parallel execution, containing preemptively scheduled threads and SMP backing/support. High priority non-delay able threads are ordinarily static priority. A timesharing thread's primacy is upraised and pulled down to set scales for its resource depletion in contradiction to timesharing threads.

Memory Management

If a processing system does not have adequate main memory to embrace all its active processes, it necessarily page or swap some address space to secondary memory: When the system is squat of main memory, it writes singular pages of selected processes to secondary memory but still leaves those processes runnable. When a process executes, if it entrances those pages, it must kip/sleep while the pages are delivered back into main memory. When the system gets into an extra severe unavailability of main memory, it writes every page of some processes to secondary memory and in scripts those processes as swapped. Such processes recoup into a state where they can be scheduled merely by being selected by the system scheduler daemon process, and then read back into memory. Both can root deferrals when a process is all set to execute again. For processes that have austere scheduling necessities, this interruption can be intolerable. To dodge swapping delays, real-time processes are certainly not swapped, however chunks of them can be paged. A program can avert paging and swapping by securing its text and data into main memory. How much memory can be locked is restricted by how much memory is organized. Also, bolting excessively can ground inexcusable deferrals to processes that do not have their text and data protected into memory. [4], [5], [9]

Four rudimentary memory managing data structures are used in Mach: the resident page table, the address map, the memory object, and the pmap. [9]

Inter-Process Communication

Conjoint segregation and harmonization (or the inter-process communication, IPC) are attained over consumption of ports. Most system assets are retrieved through a level of indirection known as a port. On an intangible level, a port is an endpoint of one directional or one way correspondence amid a client who demands a facility and the server that delivers the facility. A response from the server, such as a provision application, needs a second port. Most resources are discussed in an object-oriented approach. [5], [9]

Objects can have various ports, such as name and control ports. The control port is every so often termed as the privileged port, and lets the object to be employed. Right to use the name port solely names the object.

Message queues - A message possibly will comprise of pure data, replicas of memory series, port privileges, kernel and implied characteristics, such as the writer's confidence symbol. Only individual task can embrace the receive-right for a port indicating a message queue. This task gets messages from the port queue. Several tasks can hold privileges to the port and permit them to direct messages into the queue. Tasks converse by fleeting data structures holding data elements and executing message-send procedures on ports for which they grasp transfer rights. The task per accept rights at that time does a message-receive job. Compound threads may well endeavor to accept messages from a certain port, but merely one thread will accept any certain message.

Semaphores - Semaphore IPC objects upkeep wait , post , and post all procedures, but enclose no data. These are totaling semaphores, in that posts are totaled if there are no existing waiting threads. All pending threads can be stirred by post all.

Notifications - provision the post and wait procedures, but with the toting of a state field. Every post overwrites the preceding state. The state field has a static arrangement and is demarcated when the notification object is instantiated.

Locksets - Through the operation, the thread clutches the lock. When it proceeds from the transaction, the lock is free. There is no data concomitant with the lock.

Remote procedure calls (RPC) - RPCs are aimed to help and augment distant procedure calls. Their principal lines are transaction focused, and while one is generated, a set of argument chunk formats is demarcated. A client marks an RPC call, which causes a message to be created and queued on the object, then eventually passed to the server. When the server returns from the transaction the retort is resumed to the writer (client). Mach enhances the transaction by performing the server using the client's resources, called thread migration. [9]

File Management

The Darwin kernel outfits a Virtual File System (VFS) that deciphers a file-related system call into the identical call for the suitable file system.

Fig. 4. File management in Mac OS X

File System

Partitions are normally laid out via specific variation of the HFS + file system, which delivers debauched Btree-based searches, stout pseudonyms, and opulent metadata. Partitions can be arranged with HFSX, a case-sensitive different of HFS + projected for compatibility with UNIX software. For interoperability with Windows, systems disks may be formatted with FAT32 or exFAT.

Hierarchical File System Plus

HFS+ is selfsame similar to its ancestor, HFS, in footings of its core style. A volume is an occurrence of a file system. An HFS+ volume can engage in an intact disk, or it may be billed only a room of a disk. The defaulting and ideal sector magnitude for the Mac OS X employment of HFS+ is 4KB. Allocation blocks are numbered successively, and can be stated to by an unsigned 32-bit integer block figure. This was one enhancement above the novel HFS, which was restricted to 16-bit block digits.

HFS+ hold onto the ranges of connecting allocation blocks called extents. An extent is symbolized in HFS+ by a data structure entitled an extent descriptor.

In HFS+, files are resided of two creeks of bytes: resource fork and data fork.

The first two logical sectors and the final logical sector of an HFS+ volume are kept back, granting this held in reserve space is not castoff by Mac OS X. The third logical sector is the volume header, which covers imperative data about the volume for example the localities of the volume's added data structures. Placed nearby the end of the volume is an unconventional volume header, which is a replica of the volume header.

There are numerous vital B-Tree structures in an HFS+ employment. The Catalog B-Tree stores the elementary metadata for the volume's files and directories. The Extents Overflow B-Tree stocks the supplementary extent records of files that are excessively huge to be confined wholly inside the Catalog B-Tree. The Attributes B-Tree holds extended attributes for the volume's files and directories. There survives a Hot Files B-Tree which is used to record info about recurrently retrieved files.

I/O Device Management

Apple has entirely reshaped the Macintosh I/O design, providing a structure for abridged driver development that cares countless types of devices. This framework is called the I/O Kit. All hardware support is provided straight by I/O Kit objects. One exclusion to this decree is imaging devices such as printers, scanners, and digital cameras. [4]

I/O Kit Arcitecture

The I/O Kit affords a ideal of system hardware in an object-oriented framework. Every one category of facility or device is epitomized by a C++ class; each discrete service or device is denoted by an occurrence (object) of that class. [4]

There are three foremost conceptual features of the I/O Kit design: families, drivers, and nubs.

A family terms a pool of high-level constructs collective to all devices of a certain type that grosses the method of C code and C++ classes. Families may take account of headers, libraries, sample code, test hitches, and documentation.

A driver is an I/O Kit object that accomplishes a particular device or bus, bestowing an added theoretical vision of that device to other parts of the system. When a driver is encumbered, its compulsory families are likewise encumbered to deliver obligatory, shared functionality. The wish to load a driver bases all of its reliant on requirements (and their requirements) to be laden first. After all necessities are seen, the demanded driver is laden as well.

A nub is an I/O Kit object that characterizes a plug of link for a driver. It embodies a manageable unit such as a disk or a bus. A nub is loaded as slice of the family that instantiates it. Each nub runs access to the device or service that it represents and provides services such as matching, arbitration, and power management.

Fig. 5. I/O Kit Architecture

Fig.5. illustrates the I/O Kit architecture. In this case, a SCSI stack is shown, with a PCI controller, a disk, and a SCSI scanner. The SCSI disk is controlled by a kernel-resident driver. The SCSI scanner is controlled by a driver that is part of a user application. This example illustrates how a SCSI disk driver (Storage family) is connected to the PCI bus. [4]

The PCI bus driver discovers a PCI device and announces its presence by creating a nub (IOPCIDevice). The nub's class is defined by the PCI family. The bus driver identifies (matches) the correct device driver and requests that the driver be loaded. The SCSI controller driver scans the SCSI bus for devices. The controller driver identifies (matches) the correct device driver and requests that the driver be loaded. Loading the disk driver causes all required families to be loaded as well. In this case, the Storage family is loaded; the SCSI family (also required) is already present. The disk driver is given a reference to the IOSCSIDevice nub. [4]


Mac OS X has managed to become rather Utopian with time. It doesn't alienate one from UNIX. In fact, it gives a very colorful environment to play with: it has Mach, FreeBSD, a nice driver development environment, and a lot of the system's source code to go with it. There is a lot of professional quality (mostly commercial) software available for the Mac. In its current form, Mac OS X is uniquely positioned, unlike any other system, to offer the benefits of the UNIX Universe as well as counterparts (either the same or with similar functionality) of important software from the Windows Universe. Apple has been busy adding to Mac OS X a lot of valuable software they created in-house.

Mac OS X is representative of a "best-effort" approach - Apple took technology they had collected over the years, along with technology that had flourished in the open source world, and put together a reasonable system.