
Optimistic Incremental Sp ecialization: Streamlining a Commercial Op erating System y Calton Pu, Tito Autrey, Andrew Black, Charles Consel, Crispin Cowan, Jon Inouye, Lakshmi Kethana, Jonathan Walp ole, and Ke Zhang Department of Computer Science and Engineering Oregon Graduate Institute of Science & Technology ([email protected]) Abstract siveinterpretation and checking of the currentenvironment b efore taking action. One of the lessons of the Synthesis Conventional op erating system co de is written to deal with op erating system [25] is that signi cant gains in eciency all p ossible system states, and p erforms considerable inter- can b e made by replacing this generic co de with specialized pretation to determine the current system state b efore tak- co de. The sp ecialized co de p erforms correctly only in a re- ing action. A consequence of this approachisthatkernel stricted environment,butitischosen so that this restricted calls which p erform little actual work take a long time to environment is the common case. execute. To address this problem, we use specialized op er- By way of example, consider a simpli ed Unix File Sys- ating system co de that reduces interpretation for common tem interface in which open takes a path name and returns cases, but still b ehaves correctly in the fully general case. an \op en le" ob ject. The op erations on that ob ject include We describ e how sp ecialized op erating system co de can b e read, write, close,and seek. The metho d co de for read generated and b ound incremental ly as the information on and write can b e sp ecialized, at op en time, to read and which it dep ends b ecomes available. We extend our sp ecial- write that particular le, b ecause at that time the system ization techniques to include the notion of optimistic incre- knows, among other things, which le is b eing read, which mental specialization : a technique for generating sp ecialized pro cess is doing the reading, the le typ e, the le system kernel co de optimisticall y for system states that are likely blo ck size, whether the ino de is in memory, and if so, its to o ccur, but not certain. The ideas outlined in this pap er address, etc. Thus, a lot of the interpretation of le system allow the conventional kernel design tenet of \optimizing for data structures that would otherwise have togoonat ev- the common case" to b e extended to the domain of adap- ery read can b e done once at op en time. Performing this tive op erating systems. We also show that aggressiveuseof interpretation at op en time is a go o d idea if read is more sp ecializati on can pro duce in-kernel implementations of op- common than open, and in our exp erience with sp ecializi ng erating system functionali ty with p erformance comparable the Unix le system, loses only if the le is op ened for read to user-level implementations. and then never read. We demonstrate that these ideas are applicable in real- Extensive use of this kind of sp ecialization in Synthe- world op erating systems by describing a re-implementation sis achieved improvementinkernel call p erformance rang- of the HP-UX le system. Our sp ecialized read system call ing from a factor of 3 to a factor of 56 [25] for a subset of reduces the cost of a single byte read by a factor of 3, and the Unix system call interface. However, the p erformance an 8 KB read by 26%, while preserving the semantics of the improvements due directly to co de sp ecializati on were not HP-UX read call. By relaxing the semantics of HP-UX read separated from the gains due to other factors, includin g the wewere able to cut the cost of a single byte read system design and implementation of a new kernel in assembly lan- call by more than an order of magnitude. guage, and the extensive use of other new techniques such as lo ck-free synchronization and software feedback. This pap er describ es work done in the context of the Syn- 1 Intro duction thetix pro ject whichisafollow-on from Synthesis. Synthetix extends the Synthesis results in the following resp ects. First, Much of the complexityinconventional op erating system Synthetix de nes a conceptual mo del of sp ecializati on. This co de arises from the requirement to handle all p ossible sys- mo del de nes the basic elements and phases of the sp ecial- tem states. A consequence of this requirement is that op er- ization pro cess. Not only is this mo del useful for deploying ating system co de tends to b e \generic", p erforming exten- sp ecializati on in other systems, it has also proved essential in the development of to ols to supp ort the sp ecializati on This research is partially supp orted byARPA grant N00014-94-1- 0845, NSF grant CCR-9224375, and grants from the Hewlett-Packard pro cess. Company and Tektronix. Second, Synthetix intro duces the idea of incremental and y Also University of Rennes/IRISA (France). optimistic sp ecializati on. Incremental sp ecializati on allows sp ecialized mo dules to b e generated and b ound as the in- formation on which they dep end b ecomes available. Op- timistic sp ecializati on allows mo dules to b e generated for system states that are likely to o ccur, but not certain. Finally,weshowhow optimistic, incremental sp ecializa - tion can b e applied to existing op erating systems written dep end on invariants that are not known until runtime, and in conventional programming languages. In this approach, hence rely on a sp ecializati on pro cess that can take place at p erformance improvements are achieved by customising ex- runtime. In the context of op erating systems, it is useful for isting co de without altering its semantics. In contrast, other sp ecializati on to take place b oth at compile time and at run extensible op erating systems allow arbitrary customizations time. to b e intro duced at the risk of altering the system semantics. Given a list of invariants, whichmaybeavailable either The long term goal of Synthetix is to de ne a metho d- statically or dynamically,acombination of compile-time and ology for sp ecializi ng existing system comp onents and for run-time PE should b e capable of generating the required building new sp ecialized comp onents from scratch. Toex- sp ecialized co de. For example, the Synthesis kernel [28] p er- plore and verify this metho dology we are manually sp ecializ- formed the (conceptual) PE step just once, at runtime dur- ing some small, but representative, op erating system comp o- ing open. It is in principle p ossible to apply the run-time nents. The exp erience gained in these exp eriments is b eing partial evaluator again at every p oint where new invariants used to develop to ols towards automating the sp ecializati on b ecome known (i.e., some or all of the p oints at whichmore pro cess. Hence, the goal of our exp eriments is to gain an un- information b ecomes available ab out the bindings that the derstanding of the sp ecializati on concept rather than simply program contains). We call this rep eated application of a to optimize the comp onent in question. partial evaluator incremental specialization [15]. This pap er illustrates our approach applying sp ecializa - The discussion so far has considered generating sp ecial- tion in the context of a commercial Unix op erating system ized co de only on the basis of known invariants, i.e., bind- and the C programming language. Sp eci cally,itfocuses ings that are known to b e constant. In an op erating system, on the sp ecializati on of the read system call, in HP-UX [12] there are many things that are likely to b e constant for long while retaining standard HP-UX semantics. Since read is p erio ds of time, but may o ccasionall y vary.For example, it representative of manyotherUnix system calls and since is likely that les will not b e shared concurrently, and that HP-UX is representative of manyotherUnix systems, we reads to a particular le will b e sequential. We call these exp ect the results of our study to generalize well b eyond assumptions quasi-invariants. If sp ecialize d co de is gener- this sp eci c implementation. ated, and used, on the assumption that quasi-invariants hold The remainder of the pap er is organized as follows. Sec- most of the time, then p erformance should improve. How- tion 2 elab orates on the notion of sp ecializati on, and de- ever, the system must correctly handle the cases where the nes incremental and optimistic sp ecializati on. Section 3 quasi-invaria nts do not hold. describ es the application of sp ecializa tion to the HP-UX Correctness can b e preserved by guarding every place read system call. Section 4 analyses the p erformance of where quasi-invariants may b ecome false. For example, sup- our implementation . Section 5 discusses the implication s of p ose that sp ecialized read co de is generated based on the our results, as well as the key areas for future research. Re- quasi-invaria nt \no concurrent sharing". A guard placed in lated work is discussed in section 6.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages11 Page
-
File Size-