Advocacy

  Myths
  Press

Dojo (HowTo)

  General
  Hack
  Hardware
  Interface
  Software

Reference

  Standards
  People
  Forensics

Markets

  Web

Museum

  CodeNames
  Easter Eggs
  History
  Innovation
  Sightings

News

  Opinion

Other

  Martial Arts
  ITIL
  Thought


Unix and the Macintosh
Having it all


By: Tom Ierna

Many people are interested in running alternative operating systems on their Macintoshes. There are quite a few options available, but UNIX support is probably the most sought. Most people don't know that UNIX and the Mac play together quite well.

Brief background for UNIX:

UNIX was developed in the late 1960's by Ken Thompson and Dennis Ritchie at AT&T Bell Labs, it was strongy influenced by Multics, an operating system for minicomputers of the time. It was designed from the ground up to be a multitasking, multi user (1) operating system with protected memory - fully buzzword-compliant even by today's standards. Multi-threading was adapted, and incorporated later, but fit in the architecture well. UNIX was also coded completely in the C programming language, making it machine independent - something of a novelty back then, when operating systems were written in straight assembly.

(1) For multi-user personal computer operating systems, UNIX is the only game in town. NT is not really multi-user, it is more of a glorified file and print server with decent administration tools. You can log in as different users, but only one can be logged in at a time without special software (like Citrix's WinFrame). UNIX is true multi-user. You can create accounts for your friends and you can all be using the box simultaneously across the network - with no additional software. This includes GUI support through X-Windows. The clients can even be on diverse platforms - the only necessary common denominator is an X server on each client machine.

In 1975, UNIX was made available to universities at a reduced cost, where it became extremely popular. In 1984, the University of California, Berkeley made available an enhanced version of UNIX called Berkeley Standard Distribution (BSD) UNIX. AT&T sold the rights to UNIX and the hands have changed many times since. Currently the X/Open Company owns the AT&T source. Since then, many BSD features have been incorporated back into the AT&T variant, currently called System V. Most commercial Unices are based on this version and most free Unices are based on BSD. More recently, Linus Torvalds and programmers across the globe have developed a UNIX clone called Linux, of which there are multiple variants.

Unices and their clones all have a similar architecture, and the ideas pioneered by UNIX show through in all modern operating systems. Shared traits include kernels, file level security privileges, piping, TCP/IP networking, file-mapped protected virtual memory, load-balancing and all of the others that Microsoft claims are new technology in NT. The differences between Unices is in the details; for instance, all Unices have similar command line utilities, but each variant might have different options for these utilities. All Unices consist of a kernel, a command line and command line tools.

Mac Options

The Mac has an interesting history with UNIX. Until very recently, Apple was very tightlipped about their hardware. If you wanted to write a new operating system or port an existing one, you had to twiddle bits by hand to see what they did and then write the OS around that. For this reason, work was very slow to get any of the UNIX variants on Mac hardware until recently.

Apple had their own version of UNIX called A/UX that ran on any 030 and 040 machine with the Paged Memory Management Unit installed. This was an AT&T variant with a bunch of BSD extensions. Possibly the most interesting aspect of A/UX was that you could run stock standard System 7 compliant Mac applications on it. It wasn't until late 1992 that any Unices besides A/UX were ported to the Mac, and all of these UNIX ports were done without Apple help. NetBSD and FreeBSD are two of them. Lately however, Apple has been much more open with their hardware specs.

Prior to the acquisition of NeXT, Inc., Apple brought briefly to market the PPC based Network Server 500 and 700. These were Apple's brief foray into AIX, a version of UNIX maintained by IBM for their RS6000 boxes. Apple's version of AIX will only function on these two boxes.

PPC Mac owners have several choices, and each is distinctly different:

  1. MkLinux (mklinux.apple.com), a Linux variant, is an Apple skunk works project. It hosts the Linux kernel on top of the Mach microkernel (written at Carnegie-Mellon by none other than Avie Tevanian). Mach is an extra layer of abstraction between the kernel and hardware. This makes diverse hardware support a little easier at the expense of some speed.
     
  2. LinuxPPC (www.linuxppc.org), also a Linux variant, is a project headed up by Paul Mackerras. It builds upon the work from the MkLinux team, but utilizes a "monolithic" kernel - meaning there is no micro kernel abstraction layer. The kernel talks to the hardware directly. This ensures that for every hardware feature, bug or addition, the kernel will be modified. That's the penalty paid for a return of some 10% additional speed.
     
  3. MachTen (www.tenon.com) is a BSD variant running on the Mach micro kernel. What makes this one really different (other than the fact that it is the only shipping UNIX for the Mac that is not free) is that it runs as a standard Mac application. This means that to use UNIX, you double click an application in the Finder. Within that application's memory space (as set through the Get Info box), lives a real UNIX. This unusual (but powerful) approach has some unique trade-offs.
     
    The pluses:
    1. You can run Mac applications along side of UNIX.
    2. You don't have to reboot to use UNIX. If UNIX crashes (not likely), you can restart it with a double-click.
    3. All Macs are supported with very little change since it is really an application as far as the MacOS is concerned. It uses the MacOS hardware drivers. That means that your NuBus cards, your PCI cards and your accelerators will still work.
    4. There are two versions of MachTen - Professional and Regular. The Professional one allows MachTen to do all of the virtual memory and memory management, regardless of which OS you use. This results in more speed and stability for the Mac side.
       
    The drawbacks:
    1. While the MacOS has control of the processor, it does co-operative multitasking, and while MachTen has the processor, it does preemptive multitasking. There is a slider that controls the ratio of MacOS to MachTen processor utilization. This is a blessing and a curse because running MachTen fast enough to be usable might limit the usability of the MacOS side and vice-versa.
    2. Although MachTen uses the MacOS device drivers, making compatibility less of an issue, these may not be as robust or as fast as similar drivers on the UNIX side.
    3. If the MacOS crashes, the UNIX side does too.
       
  4. Rhapsody: (devworld.apple.com/rhapsody/) Although this is not released to the general public, it is a UNIX variant nonetheless. Based on the BSD release and hosted on a Mach Microkernel, Rhapsody is best described as A/UX with a new outlook on life. Rhapsody is made up of more than just the standard UNIX kernel, command line, command line tools and windowing system. It has a "blue box" for MacOS compatibility - sort of the reverse of what MachTen does, Rhapsody's UNIX hosts a MacOS process rather than MacOS hosting MachTen as an application. Rhapsody uses the YellowBox API (application programming interface) which is based on on work done by Steve Jobs and crew at NeXT, Inc. and their OpenStep/NeXTSTEP. YellowBox is a real Object-Orieted API that allows programmers more freedom and productivity than other API's. Most importantly to end users, Rhapsody wraps all of the text-based administration inherent with most Unices, with a very clean and powerful Mac look and feel (all those text configuration files essentially get controlled by graphical control panels and an easier to use intereface).

X marks the spot

You may be wondering: "Why is UNIX is so great: it doesn't even have any pictures to click!", but fortunately you'd be jumping the gun. All UNIX variants have a windowing system available called X-Windows. X is a windowing system that sits on top of UNIX much in the same way that Windows95 sits on DOS, only in a much more elegant fashion, with loads less overhead and with more configuration abilities than you can shake Bill's head at.

The best thing about X is that by itself, it doesn't do anything. For it to draw windows, you need a window manager. There are several of these, and each has a separate look and feel. There are window managers that look like Windows95 and ones that look like MacOS. There are some that are very plain, and others that look like alien landscapes. Each window manager is configured via a text file. You determine just about everything. The only thing that might be difficult to wrap your brain around with X is that each "client" machine requires an "X Server" if you want to deploy applications from one machine to another via a network. The "X Clients" are actually the applications running, not the other machines connecting. The "server" that holds the application binaries need not even be running X Windows.

Why use Unix?

So you might be thinking, "OK, this is a fairly complete primer for UNIX on the Mac, but why you'd want to put UNIX on a Mac".

Here are a few reasons:

  1. To learn UNIX
  2. To prepare for Rhapsody and Mac OS X (at a geeky administration and power-user level).
  3. For ease of use, MacOS rules. For scalability and reliability, UNIX rules. I run LinuxPPC on one of my Macs (a 7500 with a 604/120 card), and not only is it faster than the MacOS on the same machine, it is worlds more reliably.
  4. UNIX is ideal for serving information, be it web, database, file or print. There are Appletalk modules, web servers, high-speed object oriented databases and file and print services available for Linux - all of them native and all of them FREE!
  5. If you are interested in programming, but don't want to pay big bucks for Metrowerks Codewarrior (a very good development environment for the MacOS), UNIX has a huge array of programming tools and a set of learning and troubleshooting resources online that can't be beat.
  6. To expand your horizons. MacOS may have the look and feel you love, but most larger businesses (the ones with IS departments) like to see a rounded résumé. Besides, if you can convince anyone to buy a Mac simply because the hardware is more reliable and the processor is faster - even if they never plan on using the MacOS - that helps Apple's bottom line, since Apple makes money on hardware not software.
  7. You'll learn to hate DOS and Windows even more. MacOS is elegant and integrated, but UNIX is elegant, integrated and extremely stable.
  8. You'll understand why command lines are a good thing, especially if your only previous experience with them was DOS.
  9. Remember, Unix is the only multi-user System option.

If you still have questions as to why, then Unix is probably not the right solution for you. Unix is not for everyone. But there are certainly many that have great interest in Unix, and the Mac based Unices offers these people some pretty compelling solutions.

Terms

Some of the above terms might be a little confusing to UNIX newbies, so here's a quick rundown of some of the major ideas in UNIX.

Kernel:
The kernel acts as the arbitrator to the hardware drivers. He's the guy that does all of the nitty-gritty work like I/O, memory management, security and process management.
Process:
Every program in UNIX is a process. The kernel assigns each process a PID or process identification number. A process requires a context-switch (the stack and memory protection and so on) must all change to protect one process from the other processes. Each process may have multiple threads (which are "light processes").
Thread:
Programs (processes) often have multiple threads. A thread is a lightweight process, that does not require a context switch, and so they are "faster" (less processor intensive). Sometimes threads are incorrectly called "child-processes".
Security:
Since UNIX was designed to be multi-user, each file (and directory) has security privileges associated with it.
Command Line:
There are many "command line interfaces" (CLIs) for UNIX, and they are called shells. Common shells include C-Shell, Bash (Bourne-Again Shell) and Korn. They differ in their functionality, but they all have built-in utilities to look at the contents of directories and the contents of files. These are what you type commands into. Some are very complex, much like programming languages, some are basically rudimentary scripting tools but all allow you to do multi-step tasks by creating shell script files.
Command Line Tools:
A shell handles all of the user interaction with the kernel, and the command line is each user's parent process for any tools that they use. Tools vary from disk utilities to word processors to compilers. These are text based. Some use a library called "Curses" that allows terminal style screen building.
Piping (pipes):
Most UNIX utilities are modular in nature. You give them an input and they generate an output. You can string together commands by piping them together to achieve a desired goal. Piping is named for the ASCII "pipe" character, what is used between the commands.


Created: 6/10/98
Updated: 11/09/02


Top of page

Top of Section

Home