Mac OS in a NutshellBy Rita Lewis with Bill Fishman
1st Edition June 2000
1-56592-533-5, Order Number: 5335
368 pages, $24.95
Inside the Mac OS
The Macintosh is an integrated product encompassing the deep meshing of hardware with software, both of which are designed and manufactured by Apple Computer. During earlier parts of this book, we have discussed in great detail how to use the operating system to perform work. What we have not dwelled on is how the operating system uses its direct ties with the firmware and hardware to facilitate the ease of use delivered by the graphical user interface (GUI). (Firmware consists of small programs that run on chips in the computer separately from the operating system, which runs on the central processor, or CPU.) This chapter looks under the hood to uncover how the Mac OS really works.
What Makes a Macintosh a Macintosh?
What gives a Mac its distinctive look and feel is the close integration between hardware and software, both of which are designed by Apple to optimize the other. The Mac's system software orchestrates the input and output of data at a low machine level and manages the higher-end functions of data manipulation and display using routines that are burned into Read-Only Memory (ROM) or stored in the ROM file, coded into the System file, and added to the System via extensions. This amazing union of firmware, hardware, and software means that applications do not have to worry about GUIs, low-level processes, and all the other built-in components that make a Mac a Mac. Such centralized control over the Mac behavior provides its well-known consistency and ease of use.
As shown in Figure 16-1, there are three parts to the Mac's system software: the operating system, the Toolbox, and System extensions. These three components together provide support for applications as well as a user interface environment in which applications function:
- The Toolbox
- Basic user interface elements that contribute so much to the Mac's look and feel are part of the User Interface Toolbox (the Toolbox for short), which is embedded in ROM or the ROM file. Toolbox code is grouped together by function into sets called managers. The Toolbox has managers for generating graphics, text, windows, menus, dialog boxes, sounds, and so on. Some managers are responsible for actions rather than visible elements: the Event Manager, for example, passes application processes between other managers.
- The Mac Operating System (Mac OS)
- The Mac OS, also known as the System, is responsible for making sure that the Toolbox, applications, and physical parts of the Mac work as a unified whole. The System does this by managing all of the Mac's physical operations: directing information to and from ports or peripheral devices such as disks, and managing memory allocation for programs. Like the Toolbox, the System consists of manager sets based on function: the File Manager, Device Manager, Memory Manager, Program Manager, and so forth.
- System extensions
- Because ROM typically cannot be updated, there had to be a way to bring new technologies to the Mac at the Toolbox manager level. The solution, starting with System 7, was to provide additional Toolbox managers in software through the use of System extensions. Later Mac models can incorporate these System extensions into their ROM. This was done, for example, with 32-bit QuickDraw, which started as a System extension and is today the QuickDraw manager found in ROM. Mac OS 8.5 added Appearance Manager 1.2, QuickTime 3.0, Color Sync 2.5, QuickDraw 3D, and AppleScript 1.3 managers to the basic Mac ROM. Once a System extension is added to the Extensions folder, the Mac operating system treats it in the same fashion as the Toolbox managers it calls upon in ROM or the System file. Newer Macs use a ROM file instead of burning the routines into ROM, so the ROM file can be updated as needed.
Figure 16-1. The Macintosh user interface model
How the Mac Works
Applications call on Operating System managers, which in turn call on Toolbox managers and system resources when user interface elements are required. System resources provide actual drawings of scrollbars, windows, folders, icons, dialog boxes, buttons, fonts, and so forth for use by applications. Message exchanges (called Apple Events) fly between applications, the Toolbox managers, System managers, and its resources to accomplish the application's request--whether it's drawing a line, applying a filter to a photograph, or printing a document. Think of the Toolbox as sitting in the middle, with the application above and the System file below, orchestrating processes between ROM, System software, and hardware.
Here is the secret of why programs that follow Apple's Human Interface Guidelines on the use of the Toolbox for interface generation have smaller RAM and hard disk storage footprints than their cousins on the Wintel side: Mac applications do not have to contain the code required to set up their interfaces but use code, as needed, from the System resources.
Apple decided to separate the management of the user interface from the management of hardware to ensure that all programs running on the Mac look and feel exactly alike. As stated earlier, to ensure that all applications are provided with equal access to user interface resources, the Mac stores these routines, called the Toolbox, separately from the operating system.
Table 16-1 presents an overview of the functions of the Macintosh Toolbox.
Table 16-1: Macintosh Toolbox
What It Does
Responsible for drawing graphics and text on screen and managing all display operations.
Creates and manages windows.
Creates and manages dialog boxes, including alert boxes, modal dialog boxes, and nonmodal dialog boxes.
Creates and manages buttons, radio buttons, check boxes, pop-up menus, scrollbars, and application-defined controls such as toolbars.
Creates and manages menu bars and their menus, including the drawing of menus and their contents.
Allows applications to communicate with other applications using Apple Events. Provides applications with information about the status of processes and user actions.
Manages text input, cutting, pasting, and selection, as well as simple formatting such as bold, italic, and underline.
Responsible for system resources such as menus, cursors, and windows as well as custom resources.
Lets applications interact with the Finder to locate files and manage the desktop display.
Manages the cutting and pasting of data between applications.
Standard File package
Responsible for providing applications with standard dialog boxes such as the Open and Save As dialog boxes.
Manages the display and searching capabilities of online Help, including Balloon Help, Apple Guide, and the HTML-based Mac OS Info Center.
Responsible for creating and managing file lists within application dialog boxes.
Manages sound output.
Sound Input Manager
Manages sound input.
Manages modern dialog box elements such as tabs, sliders, sections, formatted list boxes, and beveled buttons.
The Appearance Manager
The user interface experience on the Mac is tightly controlled by the System software. The Mac System software is over 15 years old. During that time, Apple has faced a real challenge to keep up with human interface design developments and the resulting explosion of graphical communication tools that developers have brought to software. In addition, there has been a bleeding effect from the porting of nonstandard software to the Mac. Consequently, various Toolbox managers in charge of the desktop appearance are unable to keep up with the need for new System resources. Developers started ignoring the Toolbox and writing their own user interface resources with the result that the cohesive look and feel of the Mac began to fragment. Mac OS 8 added a new Toolbox manager called the Appearance Manager, which introduces System resource elements that support many of the more modern dialog box elements such as tabs, sliders, sections, formatted list boxes, beveled buttons, and so forth. In addition, the Appearance Manager updated older managers for windows, controls, dialog boxes, and menus so that they could work as a cohesive whole.
Operating System Managers
While the Toolbox is interested in the visual Mac experience, the operating system focuses on underlying operations, such as file input and output, memory management, and process and device control. The operating system functions below the Toolbox, although applications can call both the operating system and the Toolbox to handle different functions.
Table 16-2 presents an overview of the Operating System managers.
Table 16-2: Operating System Managers
What It Does
Responsible for launching, scheduling, and terminating applications
Manages the dynamic allocation of memory to applications via memory partitions
Virtual Memory Manager
Manages virtual memory (logical address spaces larger than the total amount of available RAM)
Responsible for providing applications with access to the file system, letting applications create, open, read, write, and close files
Manages file aliases, providing location information to applications regarding files, directories, and volumes
Disk Initialization Manager
Formats and initializes disks
Responsible for the exchange of information between the Mac and peripherals attached to the Mac via the Small Computer Standard Interface (SCSI) protocol
Manages the time allocated to applications for executing routines
Vertical Retrace Manager
Synchronizes routines with the redrawing of screens
Manages the shutting down and restarting of the Mac
An additional set of system services lie outside of the Toolbox and operating system. These routines are also organized into manager sets and related libraries, and they reside in the System folder. Two important system services are the Macintosh Script Management System, including QuickDraw, the Font Manager, the Text Utilities, the Script Manager, and the Text Services Manager and Navigation Services. Other separate services include QuickTime and Open Transport. These services are described elsewhere in this book.
Working with Preference Files
The System folder contains a folder of files that contain settings for most software that runs on your Mac. It's called the Preferences folder. The Preferences folder stores dozens of system preferences, plus preferences for all types of software on your Mac. It is very important not to move or disturb system preference files stored in the Preferences folder or you can corrupt the performance of the system. On the other hand, if you find that an application is not operating as quickly as before, or at all, try throwing away the program's preference file first (thus deleting any customized settings you may have selected). When installing a clean copy of your System, you can restore previous preference settings by saving from the old preference files before you install the System, and then moving the old preference files into the new Preferences folder. This is especially useful for restoring Internet settings such as home pages, email information, signatures, and so forth, which may be lost in a clean install.
The way that data is accessed from your hard drive is governed by software, namely the Finder. The way that data is stored on the hard drive is governed by hardware (or firmware), namely the file system. Both the Finder and file system determine the efficiency of how data is processed.
The Mac provides two file storage systems, one older and based on smaller hard drives, and a newer one that uses today's larger disks more efficiently. The classic Mac file system is called the Standard File Format or Hierarchical File System (HFS). The newer, more efficient system is called the Extended File Format or HFS+. (Very early Macs used a nonhierarchical system that was suitable only for small disks such as floppies.)
A Short History of Mac Hardware
The chip set used to build the Macintosh computer has always played an intrinsic part in how the Macintosh provides its integrated graphical experience. There are basically two "ages" to the Mac's hardware architecture: the Complex Instruction Set Computer (CISC) implemented in Macs as the various 680x0 Macintosh models; and the Reduced Instruction Set Computer (RISC) implemented in Macs as the various PowerPC-based PowerMac models. By transitioning to RISC processing, the Macintosh was able to offer faster processing with more flexibility in the types of computing that could be accomplished (for example computationally complex multimedia production as well as I/O-intensive database management). Table 16-3 illustrates the parallel growth of software capabilities and integrated circuitry capabilities by presenting an overview of the development of Macintosh microprocessors.
Table 16-3: Macintosh Microprocessor Evolution
So named because it has 68,000 transistors. It is considered a 32-bit chip but it transmits only 16 bits of information on any bus. Runs at 8 to 16.7 MHz.
Introduced with the Mac II. A true 32-bit chip offering internal and external 32-bit data and instruction paths. Implements an additional 256-byte instruction cache to hold frequently accessed data. Runs at 16.7 MHz.
Includes a 256-byte instruction cache plus a 256-byte data cache. Introduced the parallel bus design (so-called Harvard-style bus architecture) consisting of two 32-bit data paths in the place of the earlier single 32-bit wide path, letting the computer process multiple tasks simultaneously. First chip to include a paged-memory management unit (PMMU) to handle virtual memory. System 7 requires the 68030 chip and cannot implement virtual memory on Macs running older microprocessors. Runs at 16.7 MHz.
Consists of 1.2 million transistors. Uses two 4KB instruction and data caches. Includes a built-in floating-point math co-processor (FPU) to handle computationally complex processing. Runs at 33 MHz.
First Reduced Instruction Set Computing (RISC) chip used on Macs. Consists of 2.8 million transistors and provides on-board 32KB data/instruction cache. Supports 69 new instructions to improve cache, single-precision and floating-point processing, and bit-shifting operations. Provides a 64-bit wide data bus supporting 32-bit wide instructions. Includes a built-in FPU. Runs at one of four clock speeds: 60, 66, 80, and 110 MHz.
Lower-cost, lower-power version of the PowerPC chip designed for use in portable computers. Integrates 1.6 million transistors on a smaller, thinner chip than the 601. Used in Powerbooks and the consumer Macs called Performas. Clocked at 75 MHz.
Consists of 3.6 million transistors. The first four-way parallel instruction pipeline computer (compared to the three-way pipeline of earlier RISC chips) with the capability of executing six instructions simultaneously by using its built-in FPU. Offers a split-cache design with two 16KB caches, one for data and one for instructions. Rated to run at 120 and 132 MHz.
An extended version of the PowerPC 604 chip that achieves clocks speeds from 150 MHz to 300 MHz. Smaller than the 604 and uses less power, but contains more transistors, at 5.6 million. Offers the same unified cache scheme as the PowerPC 601 but with double the capacity (64KB data and instruction cache).
PowerPC 750 (so-called G3)
The third generation of the RISC microprocessor. Offers on-chip 64 KB split-cache design data and instruction caches. Provides a new dedicated bus for backside cache. Runs at 233 to 400 MHz.
Back to: Mac OS in a Nutshell
© 2001, O'Reilly & Associates, Inc.