The Mac OS X Panther operation system has met with both technical and commercial success. Since the debut of Mac OS X in 2001, its features have continued to improve. The initial system Mac OS X 10. 1 was originally shipped in September 2001 and was referred to as Puma; Jaguar, version 10. 2, was shipped in August 2002, and Panther, the current version, was shipped in October 2003. The focus of this paper is on the key technologies that have made Mac OS X Panther a technical success such as CPU scheduling, symmetric multiprocessing, memory protection, and virtual memory; we begin with an overview of the MAC OS X operating system.
Overview of Mac OS X Panther Mac OS, from Apple Computer, can be considered two families of operating systems: the older and now unsupported “classic” Mac OS (the system that shipped with the first Mac in 1984 and its descendants, culminating with Mac OS 9), and the newer Mac OS X. Mac OS X Panther is a UNIX-based Operating System with the intuitive user interface called Aqua. The modern core UNIX-based Operating System brings benefits such as protected memory and preemptive multitasking to Macintosh computing.
Mac OS X Panther also has a sparkling user interface capable of visual effects such as translucence and drop shadows. The central characteristic of the Mac OS X architecture is the layering of system software, with one layer having dependencies on, and interfaces with, the layer beneath it (see Figure 1-1). Mac OS X has four distinct layers of system software (in order of dependency): Application Environments consists of the frameworks, libraries, and services necessary for the runtime execution of programs developed with those API.
Mac OS X currently provides five application (or execution) environments: Carbon, Cocoa, Java, Classic, and BSD Commands. Application Services incorporates the system services available to all application environments that have some impact on the graphical user interface. It includes Quartz, QuickDraw, and OpenGL as well as essential system managers. Core Services incorporates those system services that have no effect on the graphical user interface. It includes Core Foundation, Open Transport, and certain core portions of Carbon. Kernel Environment provides the foundation layer of Mac OS X.
Its primary components are Mach 3. 0 and FreeBSD, but it also includes networking protocol stacks and services, file systems, and device drivers. The kernel environment offers facilities for developing device drivers (the I/O Kit) and loadable kernel extensions, including Network Kernel Extensions (NKEs). This integrated kernel environment is called Darwin and it is an Open Source technology available from www. apple. com/darwin. The following is the components that Mach 3. 0 and FreeBSD provide: Mach • support for SMP • untyped IPC and RPC memory management • support for real-time services • external pager • modular architecture • improved performance BSD • file systems • networking • basic security policies such as user IDs and permissions • the system framework a mechanism for exporting APIs to the application layers • the BSD process model, including process IDs and signals • FreeBSD kernel APIs • Pthreads (POSIX threads implementation) [pic] Figure 1-1 System Layer CPU Scheduling The kernel environment of Mac OS X, specifically Mach, provides the fundamental thread support.
Mach maintains the register state of its threads and schedules them preemptively in relation to one another. In general, multitasking may be either cooperative or preemptive. Classic Mac OS implements cooperative multitasking which was not very intelligent. In cooperative CPU scheduling the OS requires that each task voluntarily give up control so that other tasks can execute, so unimportant but CPU-intensive background events might take up so much for a processor’s time that more important activities in the foreground would become sluggish and unresponsive.
On the other hand, preemptive multitasking allows an external authority to delegate execution time to the available tasks. Mac OS X’s Mach supports preemptive multitasking in which it processes several different tasks simultaneously. To affect the structure of the address space, or to reference any resource other than the address space, the thread must execute a special trap instruction which causes the kernel to perform operations on behalf of the thread, or to send a message to some agent on behalf of the thread.
In general, these traps manipulate resources associated with the task containing the thread. Mach provides a flexible framework for thread scheduling policies. Mac OS X supports both the multilevel feedback queue scheduling and round-robin (RR) scheduling algorithm. The multilevel feedback queue scheduling algorithm partitions the ready queue into several separate queues and allows a process to move between queues. In the multilevel feedback queue scheduling algorithm, each run queue has various priorities that are handled in different ways.
A multilevel feedback queue scheduling thread’s priority is raised and lowered to balance its resource consumption against other threads. Round-robin threads execute for a certain time quantum (time slice), and then are put at the end of the queue of threads of equal priority. Setting a round robin thread’s quantum to infinity effectively makes the thread run-till-block within its priority. Mac OS X internally has 128 priority levels, ranging from 0 (lowest priority) to 127 (highest priority).