Mac OS X - JMU



Mac OS X

Scott Ferguson

12/4/03

CS 550

Operating Systems

Section 1

Fall 2003

Table of Contents

Introduction 3

OS X History 3

OS X Overview 4

OS X Architecture 5

Mach Kernel 6

BSD Component 6

I/O Kit 7

Processor Modes 7

Multiprocessing 7

Processor States 7

Memory Usage in OS X 8

Scheduling 9

Conclusion 10

Bibliography 11

Introduction

In this paper I will attempt to give an overview of the Mac OS X operating system. I will cover the History of the OS, the OS in general, and then the Kernel environment in detail. I will address issues like memory management, multiprocessing, and process scheduling.

OS X History

Mac OS X is Apple's UNIX-based operating. It was released in 2001 and succeeded the so-called 'classic' operating system. The “classic” operating system environment refers to the Mac OS versions up to Mac OS 9, which were all based on the same basic software that apple had released in 1984.

 

During the early 90’s Mac OS was easily the best operating system available on the market. However, with the release of Windows 95 in 1995, Microsoft released a system, which was almost as easy and comfortable to use as the Mac OS. The fact that Apple's operating systems already had all of these features almost ten years earlier didn't seem to matter as Microsoft had a significantly bigger market, which was eagerly waiting for their new system software. [3]

 

In 1997 Apple announced the take-over of NeXT, Inc. and aquired the NextStep operating system technology. NextStep was based on UNIX and seemed to fulfill Apple's expectations for their new OS. In 1998, Steve Jobs, who returned to Apple due to the NeXT deal, announced the Rhapsody strategy. Rhapsody combined OpenStep's (formerly NeXTStep) strengths such as BSD-UNIX, Mach-kernel, protected memory or pre-emptive multitasking with the Mac GUI. [3]

 

The Rhapsody project eventually became what is now known as Mac OS X. In January 2000, Apple demonstrated its new graphical user interface for Mac OS X, "Aqua". Based on technologies such as QuickTime, OpenGL and Quartz, Aqua was designed to be aesthetically pleasing to the user. It is certainly no secret that aesthetics and form are huge parts of the Apple design philosophy. Aqua was also a very powerful GUI and still had the ease-of-use Apple was famous for. Aqua managed to completely hide the UNIX from the eyes of the user. [3]

 

In March 2001, Apple finally released the first official version of Mac OS X. Mac OS X 10.0 was still very slow (much slower than the classic OS), but its impressive new features, Aqua and the stability earned it overwhelmingly positive press. Over the next two years Apple issued three major updates to the OS X operating system. These releases were known as OS 10.1, OS 10.2 (Jaguar), and OS 10.3 (Panther). [4]

Announced in July 2003, Mac OS X 10.3 (Panther) was the first Mac OS which was designed for 32 and 64-bit computers. The new Power Macintosh G5 was Apple's first 64-bit computer, which needed optimized software in order to deliver best performance. Even with the updated 64-bit enhancements, OS X 10.3 was compatible with all 32-bit G3/G4 Macs. [4]

OS X Overview

In what environment is this operating system designed to work under?

OS X is designed to work only on Apple computers that are powered by a PowerPC processor. It can be used in both single and multiprocessor systems. Most OS X systems are used as desktop workstations in creative fields such as graphic design workshops, digital video editing companies, and pro audio studios.

Did this operating system advance the state of the art?

Yes and no. The core of OS X is based on the twenty-year-old Berkeley Standard Distribution of UNIX. BSD-UNIX is certainly nothing new. The real advance Apple has provided is the powerful GUI, Aqua, that runs over the UNIX core. It is the first UNIX-based operating system that has managed to hide all aspects of the UNIX command line from the user. Many distributions of Linux have attempted this, but none have provided a GUI that is so easy to use. In terms of Apple-only operating systems, OS X is a huge step forward. OS X replaced the “classic” computing environment that had been virtually unchanged since its early versions that were released in 1984. Another state of the art feature is support for the new 64-bit processors.

Is it commercially successful?

In terms of making money for the Apple Corporation, this product has been a success. However in relation to its competitors, OS X has a long way to go. OS X currently holds only 3% of the total market share. Even though OS X is getting many users to consider “the switch” from Windows, Microsoft still enjoys a virtual monopoly of the operating system market share with a 93% user rate.

What was done right/wrong?

As far as product quality goes, Apple has done a really good job. Each version of OS X is dramatically better than the one that preceded it. It is also frequently updated. OS X has already gone through 3 major updates in its short life span. Users sometimes resent these frequent updates though, as they are required to spent fairly high amounts of money to keep their software up-to-date. A user who has bought the original version and all of its subsequent updates will have spent well over 500 dollars in a two-year period, on system software alone.

OS X Architecture

In the traditional sense, a kernel is the core that provides basic services for all the other parts of the operating system. OS X has a different kernel than most other operating systems because it contains a collection of components that communicate with one another and with the other parts of the operating system. The OS X kernel environment contains the Mach UNIX kernel, the BSD-UNIX components, the I/O kit, the file systems, and the networking components.

[pic]

The Mach kernel runs below the BSD component and provides the lowest level services and handles all input and output to and from the system. The BSD component provides networking services, the file services, and the UNIX security structure.

[pic]

Here you can see that the kernel environment runs under the core services and the application layer. The highest level on the above figure displays the different APIs (Application Program Interfaces) of the kernel environment. These APIs communicate directly to program applications. They allow application programs to call specific actions from the operating system. This saves time for the programmer since they no longer have to implement these actions in the application’s code. The most important API component is the “Classic” component. This process allows programs written for earlier versions of Mac OS to run on OS X. [2]

Mach Kernel

The mach kernel is the component that manages processor resources such as CPU usage and memory, handles scheduling, provides memory protection, and provides a messaging-centered infrastructure to the rest of the operating-system layers. In Mac OS X, Mach is linked with other kernel components into a single kernel address space.

The Mach component provides the following features:

Interprocess Communication (IPC) – IPC is basically any communication that takes place from task-to-task.

Remote Procedure Calls (RPC) – RPC is similar to IPC. It is frequently used for user-to-kernel communication, but can also be used for task-to-task or even computer-to-computer communication.

Scheduler support for symmetric multiprocessing (SMP) – The Mach scheduler is responsible for handling the scheduling of multithreaded items to the processors present in the system.

Support for real-time services – These services are for processes that require a set fraction of clock cycles, no matter what else is going on in the system.

Virtual memory support – The Mach kernel is responsible for activating and handling virtual memory once an application has exhausted the systems physical memory resources. [2]

BSD-UNIX Component

Above the Mach layer, the BSD layer provides advanced networking, performance, security, and compatibility features. This component is the basic UNIX background for the operating system. It provides the files systems, which support UNIX, Mac, and Windows file structures, networking services and Network Kernel Extensions (NKE), basic UNIX security rules (user Ids and permissions), BSD application program interfaces (APIs), and the system framework for exporting APIs to the application layers. The BSD component also includes the services needed for multiple users to log on to the system. In OS X there is a feature that allows multiple users to be logged on the same machine at the same tine. To change from one user’s desktop to the next the user just has to select the correct desktop and supply the correct password. [2]

I/O Kit

The I/O Kit provides a framework for simplified driver development that supports many categories of devices. Essentially, it handles all of the information traveling between the user and the operating system. The I/O kit also provides the user with tools to create their own device drivers, much in the way that Windows does with their Driver Development Kit (DDK). The I/O Kit component provides much needed services like true plug and play, dynamic device management, dynamic (“on-demand”) loading of drivers, power management for desktop systems as well as portables, and multiprocessor capabilities. [2]

Processor Modes

OS X operates in only 2 processing modes, user and supervisor.

User mode

User mode is the processor mode that forbids execution of privileged instructions and access to privileged registers. Any attempt to do so will result in a privilege violation exception. In OS X, virtual memory emulates some privileged instructions so that programs that use them continue to operate under virtual memory.

Supervisor mode

Supervisor mode is the processor mode that allows execution of privileged instructions and access to privileged registers.

Multiprocessing

In OS X the user has the choice to use either a single or a multiprocessor system. Multiprocessing in Mac OS X is handled by the Mach component of the Kernel. Multiprocessing is implemented in OS X by using SMP (Symmetric Multiprocessing.) In SMP the two processors share the same memory and split the work of the system. OS X handles multiprocessor-ready applications by splitting the application into multiple independent threads, which the underlying operating system then schedules to run on multiple processors. OS X also provides semaphores for use as a synchronization mechanism among cooperating threads/tasks.

Processor States

The processor states in OS X are handled almost exactly like in UNIX. To observe the states of the current processes the user simple has to type “ps” at the prompt in the UNIX terminal of OS X. Ps displays a header line followed by lines containing information about your processes that have controlling terminals. This information is sorted by controlling terminal, then by process ID.

The information displayed is selected based on a set of keywords. The default output format includes, for each process, the process' ID, controlling terminal, CPU time (including both user and system time), state, and associated command. The process file system should be mounted when ps is executed, otherwise not all information will be available. [1]

The process states in OS X are as follows:

|State |Description |

|D |Marks a process in disk (or other short term, uninterruptible) |

| |wait. |

|I |Marks a process that is idle (sleeping for longer than about 20 |

| |seconds). |

|R |Marks a runnable process. |

|S |Marks a process that is sleeping for less than about 20 seconds. |

|T |Marks a stopped process. |

|Z |Marks a dead process (a ``zombie''). |

Memory Usage in Mac OS X

One of the biggest problems with the MAC OS classic environment was that memory was handled in an inefficient way. In Mac OS X, all of that has changed. With UNIX underneath the user interface, Macintosh is now an operating system that has a very modern and very efficient memory management system. No longer does the user have to manually assign the amount of memory to a specific application.

Mac OS X's memory management system dynamically assigns memory to applications, so if an application needs more memory to perform intensive tasks, Mac OS X will automatically assign it more memory (without having to re-launch the application). Because of this change in memory management instances of "Out of Memory" errors are virtually eliminated. If the computer doesn't have enough physical memory for an application, Mac OS X will automatically switch to virtual memory, allowing the application to rely on disk space for it's memory. This, of course, makes the application run much more slowly, but this feature of Mac OS X eliminates the need to manually turn on virtual memory (which was required in OS 9). The amount of disk space used for virtual memory also is dynamically assigned based on the needs of open applications.

Unlike most UNIX systems, OS X does not pre-allocate a swap space partition for virtual memory. OS X has the ability to use all of the free space that is available on the main boot partition. Another benefit of Mac OS X is the fact that there is no requirement for a contiguous block of memory. Mac OS X therefore can use all of the available physical memory for an application before resorting to virtual memory. Furthermore, memory assigned to each application is protected from other memory segments, preventing application crashes from totally taking down the system. With these features, Mac OS X provides a much more stable and much more efficient operating system.

It should be noted that Mac OS X's memory management system is not without it's faults. The biggest change from Mac OS 9 to Mac OS X is that the system and its applications use up a LOT more memory. Mac OS X's system requirements state that it needs 128 MB of RAM, but many people recommend a minimum of 512 MB for Mac OS X to run acceptably. This amount is subjective, but one thing is for sure: the more RAM that is made available to Mac OS X, the faster it runs.

Also, Mac OS X tends to eat up all available memory, even if there is a lot of it available. This is because OS X caches as much data as it can in memory, so that it can potentially reuse that data without having to re-cache it. OS X's performance drops when all available memory is used, because it has to start removing things from memory ("paging out"), which has a performance hit.

Scheduling

Scheduling is an important aspect of an operating system, especially in an environment that supports multiple processors. In OS X the Mach kernel handles all of the process scheduling. To schedule tasks OS X uses preemptive multithreading with a dynamic priority adjustment. Mach scheduling is based on a system of run queues at various priorities that are handled in different ways.

Each process is assigned into one of the following priority bands:

|Priority Band |Characteristics |

|Normal |Normal application thread priorities |

|System high priority |Threads whose priority has been raised above normal threads |

|Kernel mode only |Reserved for threads created inside the kernel that need to run at a higher priority than all |

| |user space threads |

|Real-time threads |Threads whose priority is based on getting a defined fraction of total clock cycles, regardless |

| |of other activity |

All of these mechanisms are operating continually in the Mach scheduler. This means that threads are frequently moving up or down in priority based upon their behavior and the behavior of other threads in the system. [2]

Conclusion

With Mac OS X, Apple has provided the user with a high quality operating system. Its powerful, efficient UNIX core dives the beautiful and easy-to-use Aqua GUI. With features such as 64-bit support, protected memory, preemptive multithreading, and symmetric multiprocessing OS X is a truly state-of-the-art operating system. Finally, Apple’s real triumph in OS X is that it is the first UNIX based operating system that completely hides all aspect of UNIX from the user. Advanced users may run command from the terminal if they wish, but the average user can take full advantage of OS X without knowing a single UNIX command.

Bibliography

1.“Apple OS X-UNIX MAN Pages” URL:



2. “Mac OS X Support Guide” URL:



3. Lewis, Rita, and Bill Fishman (2002), “Mac OS in a Nutshell” US,

O’reilly Publishing Company.

4. Snell, Jason (2003). “Panther by the Numbers”, MacWorld

Magazine, Dec. 2003.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download