Overview of Mac OS X

The Mac OS X operating system has many unique and powerful features. Like other operating systems, Mac OS X is a control program for computers. But like UNIX, it is also a well-thought-out family of utility programs (Figure 1-1) and a set of tools that allow users to connect and use these utilities to build systems and applications.

Figure 1-1. A layered view of the Mac OS X operating system

Mac OS X Has a Kernel Programming Interface

The Mac OS X kernelthe heart of the Mac OS X operating systemis responsible for allocating the computer's resources and scheduling user jobs so that each one gets its fair share of system resources, including access to the CPU; peripheral devices, such as disk and CD-ROM storage; and printers. Programs interact with the kernel through system calls, special functions with well-known names. A programmer can use a single system call to interact with many kinds of devices. For example, there is one write( ) system call, not many device-specific ones. When a program issues a write( ) request, the kernel interprets the context and passes the request to the appropriate device. This flexibility allows old utilities to work with devices that did not exist when the utilities were originally written. It also makes it possible to move programs to new versions of the operating system without rewriting them (provided that the new version recognizes the same system calls).

Mac OS X Can Support Many Users

Depending on the hardware and the types of tasks that the computer performs, a Mac OS X system can support from 1 to more than 100 users, each concurrently running a different set of programs. The per-user cost of a computer that can be used by many people at the same time is less than that of a computer that can be used by only a single person at a time. It is less because one person cannot generally use all the resources a computer has to offer. That is, no one can keep all the printers going constantly, keep all the system memory in use, keep all the disks busy reading and writing, keep the Internet connection in use, and keep all the terminals busy at the same time. A multiuser operating system allows many people to use all the system resources almost simultaneously. The use of costly resources can be maximized and the cost per user can be minimizedthe primary objectives of a multiuser operating system.

Because Mac OS X is mostly run on personal desktop machines, many users do not take much advantage of these features, often getting nothing from Mac OS X's multiuser support except a graphically interesting user-switching feature and a little extra security. Concurrent use of a desktop system is rare, but network access to the command line makes it possible for multiple users to share a system, even though only one person at a time uses the console.

Mac OS X Can Run Many Tasks

Mac OS X is a fully protected multitasking operating system, allowing each user to run more than one job at a time. Processes can communicate with one another but remain fully protected from one another, just as the kernel remains protected from all processes. You can run several jobs in the background while giving all your attention to the job being displayed on the screen, and you can switch back and forth between jobs. And, of course, you can run multiple graphical applications. This capability ensures that users can be more productive.

Mac OS X Provides a Secure Hierarchical Filesystem

A file is a collection of information, such as text for a memo or report, an accumulation of sales figures, an image, a song, or an executable program. Each file is stored under a unique identifier on a storage device, such as a hard disk. The Mac OS X filesystem provides a structure whereby files are arranged under directories, which are like folders or boxes. (Apple documentation uses the terms folder and directory interchangeably.) Each directory has a name and can hold other files and directories. Directories, in turn, are arranged under other directories, and so forth, in a treelike organization. This structure helps users keep track of large numbers of files by grouping related files into directories. Each user has one primary directory and as many subdirectories as required (Figure 1-2).

Figure 1-2. The Mac OS X hierarchical filesystem


A link allows a given file to be accessed by means of two or more names. The alternative names can be located in the same directory as the original file or in another directory. Links can make the same file appear in several users' directories, enabling them to share the file easily. Windows uses the term shortcut in place of link; Macintosh users will be more familiar with the term alias. The terms shortcut, link, and alias are generally interchangeable in this context. (UNIX users are used to the term alias referring to a command macro feature provided by the shells. This book uses the term alias to refer to command macros, not for links.)


Like most multiuser operating systems, Mac OS X allows users to protect their data from access by other users. It also allows users to share selected data and programs with certain other users by means of a simple but effective protection scheme. This level of security is provided by file access permissions, which limit which users can read from, write to, or execute a file. Access Control Lists (ACLs) are available as of Mac OS X 10.4. ACLs give users and administrators finer-grained control over file access permissions.

The Shell: Command Interpreter and Programming Language

In a textual environment, the shellthe command interpreteracts as an interface between you and the operating system. When you enter a command on the screen, the shell interprets the command and calls the program you want. A number of shells are available for Mac OS X, including these two common ones:

  • The Bourne Again Shell (bash), an enhanced version of the Bourne Shell, one of the original UNIX shells

  • The TC Shell (tcsh), an enhanced version of the C Shell, developed as part of BSD UNIX

Because users often prefer different shells, multiuser systems can have a number of different shells in use at any given time. The choice of shells demonstrates one of the powers of the Mac OS X operating system: the ability to provide a customized user interface.

Besides performing its function of interpreting commands from a keyboard and sending those commands to the operating system, the shell is a high-level programming language. Shell commands can be arranged in a file for later execution (OS X calls these files shell scripts; DOS and Windows call them batch files). This flexibility allows users to perform complex operations with relative ease, often with rather short commands, or to build with surprisingly little effort elaborate programs that perform highly complex operations.

Filename Generation

When you are typing commands to be processed by the shell, you can construct patterns using characters that have special meanings to the shell. The characters are called wildcard characters. These patterns represent a kind of shorthand: Rather than typing in complete filenames, users can type in patterns and the shell will expand them into matching filenames. These patterns are called ambiguous file references. An ambiguous file reference can save you the effort of typing in a long filename or a long series of similar filenames. For example, the shell might expand the pattern mak* to make-3.80.tar.gz. Patterns can also be useful when you know only part of a filename or cannot remember the exact spelling. For example, the command ls *memo* lists all the filenames containing the string memo.

Device-Independent Input and Output


Devices (such as a printer or terminal) and disk files appear as files to Mac OS X programs. When you give a command to Mac OS X, you can instruct it to send the output to any one of several devices or files. This diversion is called output redirection.

In a similar manner, a program's input that normally comes from a keyboard can be redirected so that it comes from a disk file instead. Input and output are device independent; they can be redirected to or from any appropriate device.

As an example, the cat utility normally displays the contents of a file on the screen. When you run a cat command, you can easily cause its output to go to a disk file instead of the screen.

Shell Functions

One of the most important features of the shell is that users can use it as a programming language. Because the shell is an interpreter, it does not compile programs written for it but rather interprets them each time they are loaded from the disk. Loading and interpreting programs can be time-consuming.

Many shells, including the Bourne Again Shell, include shell functions that the shell holds in memory so that it does not have to read them from the disk each time you want to execute them. The shell also keeps functions in an internal format so that it does not have to spend as much time interpreting them.

Job Control

Job control is a shell feature that allows users to work on several jobs at once, switching back and forth between them as desired. When you start a job, it is frequently in the foreground so that it is connected to your terminal. Using job control, you can move the job you are working with into the background and continue running it there while working on or observing another job in the foreground. If a background job then needs your attention, you can move it into the foreground so that it is once again attached to the terminal. The concept of job control originated with BSD UNIX, where it appeared in the C Shell.

A Large Collection of Useful Utilities

Mac OS X includes a family of several hundred utility programs, often referred to as commands. These utilities perform functions that are universally required by users. An example is sort. The sort utility puts lists (or groups of lists) in alphabetical or numerical order and can be used to sort by part number, last name, city, ZIP code, telephone number, age, size, cost, and so forth. The sort utility is an important programming tool and is part of the standard Mac OS X system. Other utilities allow users to create, display, print, copy, search, and delete files as well as to edit, format, and typeset text. Most of the utilities are installed by default under Mac OS X, but some (such as those in the Developer Tools package) must be installed separately. The man (for manual) and info utilities provide online documentation of Mac OS X itself, as does the GUI Help application available from the ubiquitous Help menu.

Interprocess Communication

Pipes and filters

Mac OS X allows users to establish both pipes and filters on the command line. A pipe sends the output of one program to another program as input. A filter is a special form of a pipe that processes a stream of input data to yield a stream of output data. A filter processes another program's output, altering it as a result. The filter's output then becomes input to another program.

Pipes and filters frequently join utilities to perform a specific task. For example, you can use a pipe to send the output of the cat utility to sort, a filter, and then use another pipe to send the output of sort to a third utility, lpr, that sends the data to a printer. Thus, in one command line, you can use three utilities together to sort and print a file.

System Maintenance and Administration

On an OS X system, the system maintainer or administrator is frequently the owner and only user of the system. This person has many responsibilities. The first responsibility may be to set up the system and install the software.

Once the system is up and running, the system maintainer is responsible for downloading and installing software (including upgrading the operating system), backing up and restoring files, and managing such system facilities as printers, terminals, servers, and a local network. The system maintainer is also responsible for setting up accounts for new users on a multiuser system, bringing the system up and down as needed, and taking care of any problems that arise.

A Practical Guide to UNIX[r] for Mac OS[r] X Users
A Practical Guide to UNIX for Mac OS X Users
ISBN: 0131863339
EAN: 2147483647
Year: 2005
Pages: 234

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net