Copland grapples with multitasking

New OS will protect independent processes

(Apple's upcoming version of the Mac operating system)

Robert Hess
MacWEEK

November 28, 1994

Apple's next major revision of the Mac operating system, code-named Copland, will reportedly offer two key features missing from the current OS: pre-emptive multitasking and protected memory. That assumes, however, a liberal definition of how these features work.

Contrary to published reports, Apple has not altered its System 8 plans in response to Windows 95. According to one developer, "They were telling us about these features way back at [Apple Worldwide Developers Conference] in May, and they say everything is the same today."

Copland will be based on a protected memory model and pre-emptive task scheduler. To retain compatibility with current applications, however, Apple is building System 8 to retain cooperative multitasking for current programs while allowing protected, pre-emptive processes within new applications.

According to sources, when a Mac is started up with Copland, the Macintosh Toolbox will be loaded into an independent, protected address space in memory. This enforced isolation will prevent applications from inadvertently trampling Toolbox code and bringing the Mac to its knees.

Another crucial address space, referred to as the Blue Box, will also be created at start-up. This area of memory will be the Mac OS' compatibility layer, much like a structure used by A/UX, which will permit current Mac program code to run in the new pre-emptive environment. Without the Blue Box, sources said, today's software would not run under Copland.

As the start-up process continues, system extensions will be loaded in one of two ways. Software written to pre-Copland specifications will be loaded into the Blue Box. Extensions written for Copland will be given their own address spaces, which can be both pre-emptive and protected.

When applications are launched, they will be loaded into the Blue Box by default and will run essentially the same as they do today. It will still be possible for one poorly written program to crash the shared-memory and cooperatively multitasking Blue Box, terminating the applications within it.

New applications written for Copland, however, will be able to create protected and pre-emptive processes, called threads, based on a subset of their code. For example, an application could create a thread that calculates a complex equation and returns a result when complete, or a compression engine that sits in the background awaiting instructions to expand or compact a file.

Several restrictions will be placed on these pre-emptive threads. They will be unable to access many routines in the Mac Toolbox; the most restricted will be those parts that provide the user interface. The sections of the Toolbox that will be available to threads include those controlling file I/O and networking.

The decision as to whether a piece of code should operate inside the Blue Box or as an independent task will be based to a large degree on the extent to which that task needs access to Mac Toolbox routines. Therefore, sources said, Copland-aware software will likely evolve into interface shells that handle user interaction inside the Blue Box and invisible threads that handle background or processor-intensive duties.

Apple events and other, higher-performance intra-application communication will let programmers break up an application into these functional pieces, and a Mac running Copland-aware software reportedly will offer a close approximation to a fully pre-emptive environment.

But not quite. Under a "true multitasking" environment each application exists in its own address space and would be entirely protected and pre-emptive. For years Mac users have lamented the lack of these features in the Mac OS. According to one source, however, these features are often overrated: "People aren't going to wake up the day Copland premieres and live in some sort of Nirvana. Anyone who has used Windows NT, OS/2 or Unix for very long knows it's not only possible but fairly easy for those OSes to crash to a point where the computer must be rebooted."

Pre-emptive multitasking threads also may not provide the performance benefits users expect. The source added: "Your Mac isn't suddenly going to become remarkably faster, either. You still have a set of applications sharing the same processor. Pre-emption just means that outside Blue Box one process can't dominate the whole Mac."

Users will notice an immediate change in the effects of interaction with the Macintosh interface. Currently, pulling down a menu or pressing on a scroll box stops other processes until the mouse button is released. Thanks to Copland's pre-emptive Toolbox, applications and tasks will continue to run under these conditions.

While Apple declined to comment on specifics, Vito Salvaggio, Copland's product manager, said the OS is still in an investigative stage in which features, including pre-emption and memory protection, are being refined.

COPYRIGHT 1994 Mac Publishing