| OS X, Part II |
| Written by Dennis Sellers | Hits : 234
| Sunday, 01 October 2000 00:00 |
|
OS X will bring a lot of hands-off computing, and
tinkering capability for gearheads.
This is the second of three columns looking at Mac OS X, the next-generation operating system from Apple that's due in early 2001. For those who can't wait that long--and for more adventurous users--Apple has released a public beta. So what will Mac OS X mean for you? What are its benefits? Let's look at some of the buzzwords surrounding X and what they mean in real-world scenarios. Protected memory We Mac users like to boast that our systems don't crash as often as Windows. And (ahem) that's true, but they do occasionally crash. And when one application goes down, your whole system can go down in flames alongside it. That's because the current Mac OS doesn't have protected memory. Mac OS X will. Protected memory means that the operating system won't let applications grab a hunk of memory that belongs to another app--or to the operating system itself. By implementing this, Mac OS X will make your Mac more crash-resistant. In other words, Mac OS X will have a modern, robust protected-memory architecture that allocates a unique address space for each application or process running on the computer. When apps and processes are isolated in their own memory space, they can't interfere with each other if one goes bad. And when one program starts acting naughty, Mac OS X will simply shut it down, close down its memory space, and let you continue working. You won't have to restart your computer. Better virtual memory But wait, there are even more memory goodies in Mac OS X. It will have a more efficient virtual memory (VM) manager. VM is addressable memory beyond the limits of the available physical (real, if you will) memory. In the current Mac OS, the user decides via the Memory control panel whether to use virtual memory and how much to use. And the selections don't take place until you restart your Mac, at which time the OS allocates the user-specific amount of VM and its corresponding disk space. Launch application, and the operating system allocate fixed-size memory partitions. But VM is always on in Mac OS X. In fact, you can't turn it off. And it's dynamically allocated; in other words, you won't have to specify a fixed amount for it. In theory, virtual memory is a good thing, because it enables programs to use more memory than is physically present on a machine. It does this by swapping out portions of memory to disk in order to re-use that memory for other processes. But so far, this has meant reduced system performance on the Mac OS (you've probably used software that specifically tells you to disable virtual memory) because disk access is slower than memory access. The Mac virtual-memory implementation has always been slow, but Apple says this will change with Mac OS X. Extensions, hit the road Another reason that Mac OS X should be more stable than the current operating system is that it will do away with extensions, those patches to the operating system that add extra capabilities. Extensions are one of the most notorious causes of system conflicts and crashes. On the other hand, they've often been necessary to tweak the operating system for a particular application or task. For this reason, Apple says it will leave some hooks in place, not just for backward compatibility, but also to allow loadable sets of services. However, these will probably resemble the installable modules used by Linux and most versions of Unix. If those terms scare you, don't worry. Functionally speaking, end-users like us probably won't see much of a difference, except that our Macs won't have to load rows of extensions when booting. In other words, it seems that OS X will replace traditional extensions with faceless applications that run invisibly. As they run, they'll modify the system in whatever way they are meant to. Pre-emptive multitasking X will also mark the spot when it comes to pre-emptive multitasking, the ability of applications to interrupt each other, do some processing, and surrender control to other processes when necessary. The current Mac OS can (sorta) do multitasking, but not very effectively, using what is called cooperative multitasking. Under this system, apps need predefined size information in order to tell the system what resources they require. Programs must explicitly tell the Mac OS when they can be interrupted. On the other hand, pre-emptive multitasking forces applications to share processing time. It's a historical feature of intrinsically multitasking operating systems such as Unix. And to oversimplify matters, a Unix engine powers Mac OS X. In Apple's words, pre-emptive multitasking "works like an air traffic controller, watching over your computer's processor-prioritizing tasks, making sure activity levels are at maximum, and ensuring that every task gets the resources it needs." Multithreading If multitasking sounds cool, how about multithreading? It is cool, but it's a bit complicated to explain. A thread is a path of execution, a subprocess that runs within the context of a "parent" process, sharing access to the data and other resources of the parent. For example, one thread in a program might handle user interactions, another might tackle calculations, and a third thread might deal with input-output operations. With Mac OS X, developers can divide operations so that they're performed by more than one process, by more than one task in a single process, or by more than one cooperatively scheduled thread within a single task. Threads are usually started to manage different input and output events. One thread can be waiting for mouse clicks, another one can be waiting for a monitor's keyboard input, while a third can perform screen updates. The result should be OS X native applications that run more efficiently. Since they share access to the resources of the parent process, they require fewer resources themselves. The current Mac OS uses pre-emptively scheduled tasks. The microkernel--the central part of the operating system that controls the rest of the OS--can butt in on these tasks at any time and cause them to execute in any order. But cooperatively scheduled threads can't interrupt each other. They turn over control to each other at developer-defined points. Multiprocessor support Mac OS X will also have built-in support for computers with multiple processors. And Apple has, not coincidentally, just released two multiprocessor Power Mac G4 minitowers. The current Mac OS can't easily take advantage of multiple processors. Developers have to specifically program software programs for them to find and spawn threads onto more than one processor. If that doesn't happen, the additional processors just sit there like bumps on a log, doing nothing. Mac OS X, however, will assign each thread to whichever processor has less to do, so there'll be no slackers sitting around idle. This is called symmetric multiprocessor (SMP) support. With an SMP system like OS X, every processor on the computer executes its own copy of the operating system and communicates with other processors as needed. Developers don't have to perform special programming to take advantage of SMP systems. Rather, the OS itself automatically schedules multiple tasks to execute simultaneously on any available processors. The result: big performance boosts. About those Unix underpinnings A few paragraphs up, we said that Mac OS X was Unix-based. That sounds kind of scary. What will keep us average users from having to open and interpret the dreaded config files? Even more, what will stop us from screwing up those files? Apple says not to worry. The company is going to great lengths to hide the Unix underpinnings from the end-user. By default, most of the UNIX "services" that require configuration files will ship disabled. Many of them will not even be installed by default. Those that are enabled and user-configurable will have a configuration panel in the Control Panel (yep, Mac OS X will only have one, not the couple of dozen present in Mac OS 9.) Those that simply can be turned off or on with no configuration will have a radio button somewhere to do that. However, power users who enjoy knowing everything about their systems will want to have access to config files just the same way that current power users enjoy playing around with ResEdit and Norton's Disk Editor from time to time. To this end, Apple has publicly demoed an XML config-file editor that offers a graphical user interface for config-file editing for those who need it. In fact, according to Apple's "Inside Mac OS X: System Overview," a book for developers, Mac OS X may come in two versions. "Normal" users will buy a version that doesn't contain much of the command-line Unix layer, and only developers or server administrators will get the Unix tools. This way, third-party developers won't be able to distribute software whose installation instructions include mind-boggling things like "type ./configure, then edit /etc/foo.conf." Next month, we'll look at Classic, Carbon, Cocoa, and Java--and explain what the heck they are and how they work with OS X. Contributing Editor Dennis Sellers also writes for several Mac-specific publications. |

