Sei sulla pagina 1di 4

A New Model of Abstraction for Operating System Design

Gregor Kiczales, Marvin Theimer, and Brent Welch


( gregor,theimer,welch} @parc.xerox.com
Xerox PARC
3333 Coyote Hill Road
Palo Alto, CA 94304

Abstract The intuition behind much of the current work in the OS


The historica h i s of operating systems work has been community can be summarized as follows:
the concept of black-box abstraction. But, we believe that The application programmer, and not the operat-
this traditional notion of abstractionfails to support emerg- ing system implementor, is in the best position to
ing practice in the operating system community where, determine just how the operating system should be
more and more, we seem to want to give clients access to implemented--it is only with an understanding of the
previously internal aspects of the implementation. We behavior of the application that an informed judge-
present a new model of abstraction, dual-abstraction, and ment can be made about how to make the perfor-
show how to think about existing work under that model. We mance trade-offs in the OS. While a clever OS
also discuss some issuesf o r future work that the new model implementor might be able to provide a good
makes evident. generic implementation, there will inevitably be
applications whose “usage patterns” are such that a
different implementation will be desired.
1 Introduction The task is to find a way to “open the OS imple-
We are taught, from the early days of our education as mentation up” so that clients can selectively replace
software engineers, that the concept of abstraction is funda- or adjust those parts of the implementation that don’t
mental to all the systems we build. While it is difficult to meet their perfonnance needs.
define this concept precisely, we are all familiar with the h writing this paper, we have three goals: First, to show
basic notion that we should design “clean, elegant interfaces that current work in the OS community is, in fact, driven by
to a system that hide the implementationdetails” from the this intuition that black-box abstraction is no longer viable.
client. The underlying idea is one of reuse: by making the Second, to present an initial sketch of a new model of
abstraction interface general, and isolating the client from abstraction, and show that it is useful to think of existing
the details of the implementation,we hope to make it possi- work in these terms. Third, to see what that sketch has to say
ble for a large number of users to use the same abstraction about longer term work, and what the real difficulties will
without caring about the implementation.This principle has be in making operating systems that do a radically better job
been at the very heart of the notion of operating systems, of being adjustable by their clients.
where the original goals were to provide a library of useful
base functionality and manage the interaction among vari- 2 OperatingSystems Already Provide Custom-
ous users contending for the resources of the machine. ized Implementations
While some would be reluctant to come right out and say That the operating system community has long realized
it, it is evident that much of the OS community no longer that implementationscannot be opaque black boxes is evi-
believes in this model of abstraction. We have recognized dent in a variety of work. One of the primary examples is
that not only is it not possible to hide the implementation virtual memory management.
from the client--the performance characteristics of the
Most applications see virtual memory as a traditional
implementation will always show through--but also it isn’t
operating system abstraction whose implementation is
a good idea to prevent the client from having access to those
opaque and works adequately. However, some applications
details--for performance reasons they would often like to
exhibit patterns of page access that interact badly with the
adjust them.
page replacement strategies used by generic implementa-

346
0-8186-3015-9/92 $03.00 0 1992 IEEE
tions. The response of operating system designers has been ing the desired functionality. It is to avoid this drastic reim-
to add parameters or operations to the VM interface that plementation overhead that operating systems research has
allow applications to declare their access patterns for increasingly focused on how to expose the generic imple-
selected regions of memory. An example is the madvise mentation of an abstraction in order to allow its customiza-
system call provided in Berkeley UNIX. tion.
Adding these parameters is based on the recognition that The primary contribution of this paper is to provide a
a single, fixed implementation won’t satisfy all prospective framework in which most of the benefits of the traditional
users. Unfortunately, it itself suffers from the same prob- approach to systems design can be maintained while mak-
lem--there is no reason to believe that n fixed implementa- ing implementations “open” in a principled manner to those
tions (for any reasonably small value of n) will satisfy all applications that need it. In particular, we propose a “dual
prospective users. The response of some systems, such as abstraction” approach in which the behavior of the system
Mach, has been to go to a more general approach in which is provided in a traditional way by the first, or base-level
the VM implementation is partially supplied by the applica- abstraction, and the second, or meta-level, interface makes
tion in the form of an external pager process[l]. The exter- it possible to customize the implementation of that func-
nal pager implements the protocol between the VM system tionality. The advantage of this approach is that clients of
and the backing storage for a memory object. In this case the abstraction that are happy with its generic implementa-
the pager runs as a separate process in its own address tion can simply use the base-level interface: it is no more
space, not as part of the operating system kernel. complex than it would have been under the traditional
These examples illustrate two basic approaches to oper- story. But when the performance of the generic implemen-
ating system custornization: selection from a set of kernel- tation becomes unacceptable to a particular client, that cli-
resident algorithms, or the use of upcall to invoke a user- ent will be able to delve into the implementation in a
level implementation of a protocol used by the kernel. The principled way, using the meta-level interface.
first approach is less flexible, but more efficient because the This approach has not been derived “from thin air.” In
customizations run in the kernel’s protection domain. The fact, we have found that similar issues exist in the domain
user-level approach provides wide flexibility, but at the cost of high-level programming languages. In particular, in the
of increased communication overhead and additional code context of object-oriented programming languages, we
in the kernel to protect against errant server processes. Both have found that it is possible to open the implementation in
of these approaches reflect the safety requirements of the a principled way using a technology we call metaobjectpro-
operating system in which customizations by different tocols [2]. The dual-abstraction framework is an outgrowth
applications should not interfere with one another. This ten- of the work on metaobject protocols.
sion between customization and safety is an important point We have developed two general principles which form a
about which we will have more to say later. basis for this approach: scope control and incrementality.
3 A Dual-Abstraction Approach to Design Scope control means that customizations of an implementa-
tion should only affect the clients that desire it; other clients
While we claim that the traditional approach of interfaces should still be able to use the generic implementation or
backed by opaque implementations is insufficient to meet their own customizations thereof. Incrementality means
all demands placed upon it, it is important to remember the that customizations should (ideally) require effort propor-
benefits that have been gained by that approach. Most appli- tional to the amount of change desired rather than requiring
cations are perfectly happy with the performance they get a complete or near-complete rewrite of the generic imple-
from the generic implementation of a functional abstraction mentation.
and are in fact simpler for not having to deal with the details
of its implementation. But, some clients simply cannot In our previous work on metaobject protocols, we
make due with the generic implementation. The problem achieved scope control and incrementality with a straight-
with the traditional model of abstraction--in which imple- forward application of object-oriented techniques. The
mentation details are not only hidden from, but also entirely class of an object controls its behavior, providing scope
off limitsto the client--is that it has nothing to say about the control. A new behavior can be added incrementally by
second situation.
In practical terms, the result is that in order to support a 1. In fact, we believe that under this approach base-level
small set of special-purpose applications one must currently interfaces should be simpler than under the traditional
supply an entirely new implementation of the functionality. approach. This is because all implementationcustomi-
That is, an application that is unhappy with 10% of the zation issues, some of which currently appear in our
implementation must do 100% of the work of reimplement- abstractions, will disappear into the meta-level inter-
face.

341
defining a subclass and overriding appropriate methods. redesigned to work more effectively with an application-
However, in the operating system arena it takes more specific thread implementation. In this example, the dual-
than this simple application of object-oriented techniques. abstraction framework would distinguish between the base
Scope control translates primarily into the following two functionality, threads, and the meta-level functionality of
issues: how to reconcile conflicts between multiple applica- scheduling control.
tion-specific modules as well as the need to prevent any one The X-kernel is designed to support a wide variety of net-
application from imposing its decisions on others against work protocols. The kernel provides a rich set of protocol
their will. Typically these issues are addressed by pulling building blocks such as client-server binding, “blast” proto-
the application-specific functions out of the operating sys- cols for high throughput, retransmission for reliable &ins-
tem kernel and putting them into their own address space port, and selection among addressing formats. The actual
(e.g., an external pager process) or into the application’s protocols are configured by specifying a graph that
address space (e.g., a thread package). The operating sys- describes the interconnections of the building blocks. The
tem remains in charge of mediating access to physical graphical specification is essentially a rneta-level interface
resources (e.g., page frames and processors). However, about the protocol implementations.
communication between address spaces is expensive and
File system design is another area where it can be bene-
hence the cost of interaction between the application-spe-
ficial to make a distinction between base and meta-level
cific parts of a system and the parts that meditate between
functionality.The basic file system interface is one that pro-
applications has dominated the design of systems so far
vides openclose-read-write access to files. Implementation
131141. issues such as buffering, cache consistency[7], server repli-
The use of separate protection domains to achieve scope cation, and disconnected operation [8], are refinements that
control can confict with the goal of incrementality because, most applications do not want to have to deal with. How-
in practice, large pieces of functionality are moved into sep- ever, some sophisticated clients may want control over
arate address spaces. For example, Mach clients can either these features. A meta-level interface that is cleanly Sepa-
supply their own external pager or use the one in the Mach rated from the base file system interface can provide control
kernel; but they cannot take the generic kernel VM imple- to these clients without disturbing the clients of the basic
mentation and make incremental changes to it. Providing interface.
the ability to incrementally modify part or all of an operat-
ing system facility implies that the entire implementation 4 Future Work
must be placed in suitable protected domains for safety The dual abstraction model presented in the previous sec-
sake. But the overhead of communication among the vari- tion provides a natural framework for thinking about imple-
ous protected parts may neutralize the very performance mentations which ‘‘open themselves up” to their clients. It
gains that the customization seeks to gain. The challenge is is consistent with the familiar principle that behavior and
to m e up with new designs for the traditional operating implementation should be separated--the base level abstrac-
system abstractions that are open to incremental customiza- tion provides the functionality, the meta-level abstraction
tion. can be used to adjust the implementation of that functional-
The contribution of the dual-abstraction approach is to ity. A conversation between the human designerfimplemen-
provide a principled way for separating use of functionality tor and client of an operating system might also reflect this
from control over implementation. Clients must obey a split into dual abstractions. Much of the time they would
meta-level interface to the abstraction that addresses both just talk about the functionality that would be provided. At
their desire for custonization as well as system-wide con- other times they would rely on their expertise to “go meta”
cerns about protection and scope control among multiple and talk about crucial performance issues. Implicit in this
clients. Three examples are discussed below: scheduler approach is the fact that considerable experience with sys-
activations [5], the X-kernel network protocols [6],and file tem implementations is required before a good meta-level
system protocols. interface into an implementation can be devised.
Scheduler activations augment the traditional notion of a One problem area with dual abstractions is that there are
thread with a feedback channel to the application. This some concepts that are easily expressed at the rneta-level
allows the application to react to the kernel’s scheduling but are not simply manifest at the base-level. These con-
decisions that result from blocking I/O, page faults, and pre- cepts are “global” concepts that affect all parts of a base-
emptive scheduling. In response, the application can make level implementation. Examples include concurrency con-
its best decision about which of its own threads should be trol, automatic storage management, and exception han-
scheduled on the remainiig scheduler activations. This is an dling. It is easy to specify the meta-level concept of how
example of a basic kernel abstraction, threads, that has been exception events should be handled in a system. However,

348
the implementation of exception handling in a system typi- 6 References
cally permeates almost every module of the system. Imag-
M.Young,A. Tevanian, R.Rashid, D. Golub, J.Eppinger.
ine changing fmm a policy in which callers of modules
J. CHew, W.Bolosky, D. Black and R. B m n , ” The
must handle exceptions to a policy in which the modules Duality of Memory and Communication io the
themselves are responsible for handling exceptions; it is Implementationof a Multiprocessor operating System”,
almost certain that one would need to make massive Proc. 11th Symp. on Operating System Prin., operating
changes throughout the implementation of the entire sys- Systems Review 21.5 (Nov. 1987). 63-76.
tem. With concurrency control, it is common to provide G.Kiczales. J. des Rivieres, D. G.Bobrow, “The Art of the
locking primitives that become no-ops in a single-threaded Metaobject Rotocol,” MlT Ress 1991.
environment. However, this approach doesn’t help trans-
D. Clark, The Structuringof Systems Using Upcalls, Proc.
f m a single-threaded implementation in to a multi- of the 10th Symp. on Operating System Prin., Operating
threaded implementation. Similarly, a program written with Systems Review 19,s (Dec. 1985). 171-180.
explicit free calls can easily be converted to a run with a gar-
bage collector, while the converse is not at all easy. These B. N.Bershad,T. E. Anderson, E. D. Lazowska and H. M.
Levy, User-LevelInterprocessCommunicationfor Shared
examples show that even though a concept may be easy to Memory Mdtiprocessors,ACM Transactions on
express at the meta-level it may still be difficult to realize in Computer Systems, 9,2 (May 1991). 175-198.
the base level implementation.
T Anderson, B. Bershad, E. L a z o w h H. Levy,
5 Concluding Remarks “Scheduler Activations: Effective Kernel Support for the
User-Level Management of Parallelism. Proc. of the 13th
We have presented a new framework for thinking about Symp. on Operating System Prin., Operating Systems
how to open up operating system implementations in a pM- Review, Oct. 1991,95-109.
cipled manner. Our framework is at a conceptually high-
L.Peterson, N. Hutchinson, S. O’Mally, M. Abbot6 “RPC
level: dual abstractions replace the traditional notion of
in the x-Kernel: Evaluating New Design Techniques”,
black box abstractions. The contribution of this approach is Proc. of the 12th Symp. on Operating System Prin.,
to provide a framework for organizing systems in a princi- Operating Systems Review, Dec. 1989,91-101.
pled way. As part of this new framework, we suggested two
M. Nelson, B. Welch and J. Ousterhout, Caching in the
general design principles: scope control and incrementality. SpriteNetwork File System,ACM Transactions Computer
We have shown how existing work in the community can be Systems 6.1 (Feb. 1988), 134-154.
productively considered in this new framework.
James Kistler and M. Satyanarayanan,“Disconnected
One source of related ideas we have not yet mentioned is Operation in the Coda File System.”, Proc. 13th Symp. on
the work on reflective operating systems [9]. This work has Operating System Prin., Operating Systems Review 25.5
the same intellectual roots [lo] as the metaobject protocol (October 19!91),213-225.
work which led us to our dual abstraction framework. In the Y, Yokote, A. Mitsuzawa, N. Fujinami, M. Tokoro,
next few years, we expect a productive synthesis of the “Reflective Object Management in the Muse Operating
reflective operating system work with the ideas we have System”, Proc. of the 2nd International Workshop on
sketched in this paper. Object-Orientation in Operating Systems (Oct 1991), 16-
23.
As a 6nal point, the discussion in this paper provides an
interesting perspective on the current nature of software. It Brian C. Smith “Reflectionand Semantics in a Procedural
suggests in fact that software is anything but “soft.” While Language”, PhD Thesis, MIT, January 1982.
it is true that it is more malleable than physical artifacts, the
difficulty of providing implementations that are tunable by
their clients makes it clear that we don’t yet know how to
take real advantage of that malleability.

349

Potrebbero piacerti anche