140 likes | 407 Views
On the Duality of Operating System Structures. Hugh C. Lauer, Roger M. Needham. Duality Defined. In Boolean algebra, if f(i 1 , i 2 , …) is true, dual f’ is also true, formed by swapping • with + , i with ¬i In this paper, OS models are dual if functionally equivalent
E N D
On the Duality of Operating System Structures Hugh C. Lauer, Roger M. Needham Dave Archer - CS533 - Spring 2006
Duality Defined • In Boolean algebra, if f(i1, i2, …) is true, dual f’ is also true, formed by swapping • with +, i with ¬i • In this paper, OS models are dual if • functionally equivalent • can be transformed into one another by interchanging primitives for process structure and cooperation a a = b b Dave Archer - CS533 - Spring 2006
Motivation, Goals, Approach Motive • “Religious argument” over design slows innovation • Characterize and classify operating systems designs • As message-oriented or procedure-oriented • Most systems biased toward one of these • By process structure, synchronization, IPC • Using an “idealized” model for each • Show duality, equivalence » short-circuit decision process • “Empirical” = “Engineering” approach • Observation and generalization • Informal reasoning, empirical support • Conclusion Goals Approach Dave Archer - CS533 - Spring 2006
Welsh’s “Event-Driven Server” Request FSM Consumer Request FSM Producer EventQueue Disk Request FSM Scheduler Network Request FSM • Small number of threads • Event queues • Processing organized in “handlers” • Server maintains continuation state Request FSM Dave Archer - CS533 - Spring 2006
Lauer’s Message-Oriented OS Execution“Stream” Data“Stream” • Typically real-time, e.g. Cisco Catalyst • Small, static process count • Explicit messages for communication • Passing (channels), queueing (ports), waiting for (MsgWait) data • Persistent bindings = complexity in creating processes • Cooperation by encapsulating data/ptrs in messages • Pre-emption driven by message arrival • When a higher priority process is waiting • Little or no sharing of address spaces • Data or pointers passed in messages Channel Ports Wait Send Producer Consumer SendReply WaitReply Dave Archer - CS533 - Spring 2006
Welsh’s “Threaded Server” Request 1 Consumer Request 2 Producer Protected,SharedData Network Request 3 Dispatcher Network Request 4 Request 5 • Large, dynamic thread count • Shared data structures • Processing organized in threads • Thread maintains state Dave Archer - CS533 - Spring 2006
Procedure-oriented OS • Typically time-sharing – most familiar OSs today • Large, dynamic process count • Explicit shared data system for communication • Passing (vars), queueing (monitors), waiting for (cond. vars) data • Persistent state = complexity in creating shared data • Cooperation by encapsulating data in monitors • Pre-emption driven by release of lock • When a higher priority process is waiting • Little or no messaging • data or pointers passed in shared vars Wait Wait Producer Consumer Signal Signal Dave Archer - CS533 - Spring 2006
Execution“Stream” Data“Stream” Data“Stream” Execution“Stream” Channel Ports Wait Wait Wait Send Producer Consumer Producer Consumer SendReply WaitReply Signal Signal - dual operations Dave Archer - CS533 - Spring 2006
Message-oriented system Processes Message Channel IDs Port numbers SndMsg…WaitReply Immediate Delayed SendReply WaitForMsg Main loop CASE arguments Send message Procedure-oriented system Monitors ENTRY procedure names Simple procedure names Procedure call/return Simple Fork/Join Return from Monitor Wait for lock, condition variable ENTRY procedures Signal condition variable Mapping Duality Dave Archer - CS533 - Spring 2006
Three Observations • Two OS classes are duals • One can be directly mapped to the other by replacing primitives • Logically identical to each other • almost down to syntax, if we work at it • Equivalent in performance? • e.g. queue lengths, wait times, service rates Dave Archer - CS533 - Spring 2006
What about Performance? • Three areas to worry about • Execution of programs • No difference – identical program semantics • Overhead of system calls • Send = Call • Wait = Leave • Process switching, VM access identical • Scheduling, dispatching, preemption equally efficient • Can use same disciplines • Queueing and waiting times for shared resources • Identical, since scheduling disciplines are equal • Hypothesis: Lifetime of similar computation is equal Dave Archer - CS533 - Spring 2006
One Conclusion • “In the message oriented model, objects move between processes in messages. In the procedure oriented model, processes move between objects by calling procedures.”(loosely quoted from Dearle et al, 1994) • Choosing which model to adopt relies on 2nd-order factors • 0th order = similar program structure, performance of client programs • 1st order = similar computational complexity • 2nd order = machine architecture features, programming environment – set a priori, so will drive decisions • Can drive decision closure on process structure and synchronization using these 2nd order factors Dave Archer - CS533 - Spring 2006
Believable? • Intuitive, but no formal classification or proof • Mixed acceptance among a (biased) peer community • Only one “transformable” example • 47 citations, mostly taking it on faith • One, Welsh[2002] disputes that performance is equivalent when scaled to Internet server demands • None dispute the claimed functional duality • Bottom line: close enough, except re performance Dave Archer - CS533 - Spring 2006
References • Hugh C. Lauer, Roger M. Needham. “On the Duality of Operating System Structures.” in Proceedings of the Second International Symposium on Operating Systems, IRIA, October 1978, reprinted in Operating Systems Review, 13, 2, pp. 3-19. April 1979. • A. Dearle, R. Di Bona, J. Farrow, F. Henskens, A. Lindstrom. J. Rosenberg, F. Vaughan. “Grasshopper: An Orthogonally Persistent Operating System.” Computing Systems 7, 3 (Summer), pp. 289-312. 1994. • Matthew D. Welsh, “An Architecture for Highly Concurrent, Well-conditioned Internet Services.” PhD Thesis at UC Berkeley, 2002. Dave Archer - CS533 - Spring 2006