June 95 - Copland: The Mac OS Moves Into the Future
Copland: The Mac OS Moves Into the Future
Tim Dierks
The Macintosh operating system has continually evolved since the days when the
Macintosh was a home appliance with 128K of RAM and a floppy disk drive -- but now
the time has come for radical change. The next generation of the Mac OS, code-named
Copland, was designed specifically to serve computers with a fast processor running
several tasks and processing large quantities of data. This preview describes Copland's
major features and suggests how you might get ready for it.
Since the first Macintosh operating system and Toolbox were developed in the early
1980s, the needs of users and developers alike have evolved significantly. Newer
technologies, such as MultiFinder and the PowerPC(TM) processor, have appeared on
the scene. Users have come to expect greater ease of use, more capabilities, and
enhanced productivity. Although the Mac OS has evolved along with the times, a more
radical advance is now required to take advantage of the great increases in power
afforded by the PowerPC processor.
Enter Copland, a new generation of the Mac OS to be released by Apple in mid-1996.
Copland will provide a radically new architecture that includes technologies such as
preemptive multitasking and protected memory. For one thing, it's based on a
microkernel that moderates between individual tasks and arbitrates access to the
machine's resources. A number of other services have been updated and improved, both
to fulfill the requirements this change implies and to take advantage of the new
capabilities it provides. For example, the file system has been updated to be accessible
from several processes running simultaneously in several address spaces. Similarly,
the networking system has been enhanced, as have a number of the auxiliary operating
system managers such as the Process Manager.
With Copland will also come a number of enhancements to the user experience,
including a Finder that can perform several tasks simultaneously, changes to the
appearance and feel of the interface, and advances that will make it easier to locate and
access information. (See "Moving the Mac OS Interface Into the Future" for more
details.) All of this new functionality is glued together in a runtime model based on the
Code Fragment Manager, the dynamically linked library mechanism introduced with
the first Power Macintosh computers.
______________________________
MOVING THE MAC OS INTERFACE INTO THE FUTURE
BY B. WINSTON HENDRICKSON
Copland will not only radically change the foundation of the Mac OS, it will also
introduce some of the most significant changes to the user experience since
1984. For the user, this means new personalization capabilities, built-in
assistance with tasks, and improved access to information. For the developer,
it means a robust foundation for constructing consistent and compelling
interfaces that are easier to use.
The new managers in Copland directly concerned with enhancing the user
experience are the Appearance Manager, the Assistance Manager, and
Navigation Services. The following brief descriptions of these will give you an
inkling of things to come.
THE APPEARANCE MANAGER
The Appearance Manager defines how standard user interface elements should
be presented and enables users to personalize the appearance of these elements
by choosing one of a number of graphical designs called themes. Applications
can use the Appearance Manager's capabilities to draw custom interface
elements in the style of the current theme.
The Appearance Manager provides you with
• a Pattern Manager that returns the appropriate PixPats
for use as dialog backgrounds, control colors, and other aspects of the
interface
• a set of drawing primitives for rendering common
interface elements such as window title bars and dialog separator
lines
• new standard interface elements, including sliders,
progress indicators, and icon buttons
• event notification when the current theme is changed,
allowing you to resync any cached appearance data
To prepare now for Copland's dynamic system appearance, be sure not to make
assumptions about interface specifics (such as assuming that the dialog or
menu background is white). Also, don't hard-code the appearance of your
application's interface elements; for instance, avoid the use of custom
definition procedures wherever possible.
THE ASSISTANCE MANAGER
The Assistance Manager supports the implementation of active user assistance,
enabling the computer to accomplish specific tasks with little or no direction
from the user. The Assistance Manager provides support for the following:
• task delegation, allowing the creation and management of
automated activity controlled by a condition or event, such as time or
mail delivery
• the ability to create templates from which tasks are
created and executed
• user "interviews" for task configuration, based on Apple
Guide's interaction engine
Since this active assistance is built on existing technologies, you can start to
prepare for it today. The first and most important step is to make your
application scriptable, so that it can be automated. Second, you should provide
task-based assistance using Apple Guide. Finally, if your application provides
any task delegation, you should factor out the related code now so that you can
take advantage of the Assistance Manager under Copland.
NAVIGATION SERVICES
Navigation Services replaces System 7's Standard File Package, providing a
set of tools for opening, saving, and naming documents as well as for
navigating a hierarchical information space containing such documents. These
tools will increase consistency between applications and the Finder and will
enable integration with the Finder's new and improved searching mechanism.
The new capabilities provided by Navigation Services include these:
• support for a favorite items list, file list position recall
(rebound), and a more intuitive browser
• the ability to browse diverse containers such as a mailbox
and return a general-purpose reference value to documents in those
containers
• one-step calls for common operations such as selecting a
file or directory
• support for easy customization, including an extensible
list of information "panels" (based on Copland's new dialog panels)
• automatic dialog layout adjustment for active script
systems
You can do a few things now to get ready for Navigation Services. First, when
customizing the Standard File dialog, render only inside your dialog items, as
they may be rearranged. Second, don't assume you're drawing into the desktop
port, because you won't be. And finally, don't try to control Standard File by
posting events to dialog items; use the documented interface instead. Because of
the large number of advances and changes in Copland, some software will be
incompatible. For instance, applications that have inappropriately incestuous
relationships with the operating system might run into problems. But there
are some things you can do now to prepare yourself for this release and ensure
that your applications will be as compatible as possible. I'll tell you about
those things as I give you a tour of Copland's microkernel, runtime model, File
Manager, and I/O architecture.
THE MICROKERNEL: A NEW FOUNDATION
The present Macintosh operating system is somewhat too trusting: it doesn't take
charge of restricting software's actions or balancing the use of the machine's
resources. Any piece of code can write all over memory, retain control forever, and
even turn off interrupts for any period of time. This model, while once appropriate,
has shortcomings in a computer with a fast processor running several tasks and
processing large quantities of data.
That's where Copland's microkernel, developed by Apple specifically for use in the
Mac OS, comes in. The microkernel serves as a referee for the system. It moderates
between many individual tasks so that none can hog the processor and so that special
code need not be implemented to share it. It also arbitrates access to the machine's
resources, including memory, preventing software from being able to see or change
data unrelated to its task.
The microkernel provides a number of services -- most of them familiar to those
conversant with kernel-based systems -- including task control, address space
management, virtual memory management, interrupt control, synchronization
primitives, and intertask messaging. These services, which we'll look at in more detail
in the following pages, serve as the basic building blocks of the system. In most cases,
your software won't use any of these kernel services directly but will instead take
advantage of them through other APIs -- APIs that are part of System 7 but that have
been reimplemented in Copland.
TASK CONTROL
The Copland kernel provides full support for a variety of tasking services. While
applications will normally be cooperatively scheduled by the Process Manager (just as
in System 7), applications will also be able to create tasks that are preemptively
scheduled. Preemptive tasks are scheduled in the order of their assigned priority and
according to kernel scheduling rules; the Process Manager doesn't manage them in the
way it does applications. Such tasks behave as threads behave in other systems. At any
time, almost anything in the system -- including the currently running application
-- can be preempted to run such a task. Interrupt handlers can't be preempted,
however.
You'll be able to set the priority of preemptive tasks that you create; higher priority
tasks will run in preference to lower priority ones. By giving an I/O-intensive task
higher priority than your main application thread, you'll gain performance very
similar to that made possible today by chained completion routines. During the
relatively long I/O delays when your task is blocked, your main application thread
will execute freely. Whenever its I/O requests do complete, the task will regain
control immediately so that it can issue its next I/O request, resulting in maximum
throughput without unnecessary blocking of other computing tasks. Similarly, you'll
be able to assign a higher priority to general application tasks than to background
tasks that can afford to wait or proceed slowly while the machine is in use (such as a
background renderer for a network-distributed 3D software package). This will
ensure responsiveness in your application and allow you to use otherwise idle CPU
time.
Chained completion routines are discussed in the article "Asynchronous
Routines on the Macintosh" in develop Issue 13.
To prepare for this opportunity, you can work to make your application easier to
factor. If you remove dependencies between different portions of your application, it'll
be easier to take full advantage of Copland's multitasking capabilities. When a Copland
preemptive thread runs, the file system, networking, and device I/O will be available,
similar to the environment when a Time Manager or Deferred Task Manager task runs
in System 7. One addition is that synchronous calls can be made; your thread will just
block until the I/O has completed.
ADDRESS SPACE AND VIRTUAL MEMORY MANAGEMENT
In System 7.5, there's only one address space. A particular address always refers to
the same part of memory, and data located there can be accessed by every part of the
operating system. In Copland, by contrast, multiple address spaces can be created,
allowing code and data to be hidden from some processes. For compatibility reasons,
Macintosh applications will continue in this release to share a single address space,
while components of the operating system and third-party software can create fully
protected memory areas in which code that's not dependent on the Macintosh Toolbox
can execute. The kernel, the file system, and several other components will create
such areas to protect their private data structures.
Each address space is divided into areas. An area can be either private (accessible only
to tasks executing in that address space) or global (accessible at the same location in
all address spaces). In addition, an area can be either read/write to all tasks (most
global areas fit into this category) or read-only in user mode and read/write in
supervisor mode. (Most code runs in user mode; only code that needs special abilities,
such as drivers and parts of the operating system, runs in supervisor mode.) This
latter protection is used for most kernel and file system data structures; they're
located in global memory for fast and easy access (without the need to switch to
another address space) but can't be damaged by code executing in user mode. Only the
privileged clients of the system can change these structures.
In addition to having the ability to map RAM into a variety of address spaces, Copland
also uses virtual memory to provide more room than is available in physical RAM,
moving data between RAM and disk as needed. In fact, virtual memory is always on. It's
dramatically better than System 7's virtual memory in these ways:
• The new file system and better integration between the file system
and virtual memory will improve performance.
• Your application will be able to provide hints to the operating
system to allow it to tune for best performance. For example, you'll be able to
tell it that you're about to access a significant portion of a large array, and it
will asynchronously begin to bring in the pages that the array resides on.
• Fewer limitations on what can be paged will increase the available
RAM for the system. In System 7, the system heap is always held in memory
and can't be paged onto disk. In Copland, virtually all of the system -- aside
from the kernel, the file system, and the disk driver -- will be pageable.
• The disk cache will be integrated with the virtual memory system,
and the size of the disk cache will dynamically adjust based on current
operations in order to optimize performance.
• Best of all, Copland's virtual memory will dynamically expand the
amount of address space in the system as needed, giving users much more
flexibility than in System 7, where they must decide beforehand how much
memory they'll need, adjust the Memory control panel accordingly, and
reboot. In Copland, if they need to open additional applications, they can do so
without going through any rigmarole; space will be created on the fly to
support their needs, provided that sufficient disk space is available for use as
a backing store.