410 likes | 670 Views
On the Duality of Operating System Structures. Hugh Lauer Xerox Corporation Roger Needham Cambridge University. Presentation Outline. Key ideas Duality Principle Goals and Approach Message Oriented System Procedure Oriented System Characteristics Duality mapping Similarity of Models
E N D
On the Duality of Operating System Structures Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Presentation Outline Key ideas Duality Principle Goals and Approach Message Oriented System Procedure Oriented System Characteristics Duality mapping Similarity of Models Preservation of performance Validation Conclusion References Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Key ideas • Two Broad Categories of OS • Message-oriented System • Procedure-oriented System • Most systems biased toward one of these • Both have different kinds of primitive operations for managing processes and synchronization. • No real operating system exactly fits either model in all respects. • Many operating systems have some subsystems that fit one model, and others that fit the other. Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Key ideas • Multiple Processes needs to perform operations on a single data • Data may segregated and be specific to a process (message oriented) • Data is shared in the common address space shared by all processes (procedure oriented in kernel space) • Need to avoid race condition allow process synchronization • At the time of paper, there were two camps arguing which is best- message oriented/ procedure oriented • The paper proposes both are equivalent and dual to each other Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Duality Principle • When values and operations can be paired up in a way that leaves everything important unchanged when all pairs are switched simultaneously, we call the members of each pair dual to each other. • The primitive operations of message oriented and procedure oriented systems can be swapped simultaneously preserving the logic and performance of a program. Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Goals and Approach To demonstrate that • These two categories are duals of each other- Constructs have direct counterparts • The dual programs are logically identical to each other • Performance is identical in both systems given identical scheduling strategies • Neither system is inherently better than the other • Choice of model is based on constraints imposed by machine architecture and hardware Empirical approach • Observation ,classification of properties, generalization and construction of abstract models • Informal reasoning, empirical support • Conclusion about the class of objects Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Message Oriented SYSTEm Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Model • Small number of, static big processes, often no sharing of address spaces -data references passed in messages • Process Declaration consists of Local data and algorithms, Message ports, Message channels for other processes. • Explicit messages for communication • Destination (Message Channels) • Queuing messages at destination processes (Message Ports) • Primitive operations for message transmission SendMessage, AwaitReply, WaitForMessage, SendReply Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Features • Specific communication paths • Static number of processes and the connections between them - Deletion, creation and changing connections of processes difficult because of queuing. • Process tends to operate in a relatively static context. Processes rarely share data in memory. • Similar to event handling mechanism: where events are handled synchronous with the program flow. Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Good Design Practice • Synchronization achieved by • Processes queues for congested resources in message queues attached to the processes associated with those resources. • Process access data only when it is processing a message referring to it. Does not manipulate it after it is passed on in a message to another process. • Control of peripheral devices by sending messages • Priorities are statically assigned Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Process interaction Message oriented system Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Message Oriented System Data Data Data Data Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Message Oriented System Data Data Message port1 Processes have message ports to receive messages in queue Message port2 Data Message port3 Data Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Message Oriented System Data Data Each process has its own data. A process operates on data contained by another process by means of explicit message passing mechanism Data Data Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Message Oriented System Data Data All processes waits for Requests from other Processes in all its ports. The process containing the data receives request in the form of message. Wait for Message() Wait for Message() Data Wait for Message() Data Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Message Oriented System Data Data The request is Queued in the message Port of process1 SendMessage() Process 3 sends Request for Process 1 Data. Data Data Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Message Oriented System Data Data The data is operated by the algorithm defined for that port which received the message AwaitReply() The requesting process can either block (synchronous)/ resume its operation (asynchronous) Result is sent back Data SendReply() Data Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Message Oriented System Data Data Process 1 processes next message in the queue Similar to Event handler mechanism All process processes only one message at a time. Data Data Thus synchronization is achieved!. Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Procedure Oriented SYSTEM Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Model • Procedure • Contains Algorithms, local data, parameters, results • Procedure call • Synchronous: the calling procedure blocks until the called procedure returns • Asynchronous: the calling procedure continues execution along with the called procedure • fork procedureName(parameterList) Returns processID • join processID Returns (resultsList) Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Features • Characterized by a protection and addressing mechanism for procedure call facility • Large number of small processes (threads), easy creation and deletion of processes as there are no communication channels. • Communication by means of direct sharing and locking of data. Little or no direct communication. • Similar to multithreaded environment- processes share memory in kernel space Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Good Design Practice • Process Synchronization achieved by locks, semaphores or monitors. • Congested resources result in processes blocking while waiting on monitor locks or condition variables • Data is shared between processes • Peripherals are controlled by locks and shared memory • Processes have dynamic priorities • Global naming scheme often used Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Modules and Monitors • Module is primitive unit of compilation containing Procedures and Data • A monitor is a special kind of module that has private data and procedures, protected with a lock. • Processes must acquire the lock when they call an entry procedure (a procedures which can be called from outside the monitor). • Only one process can operate inside the monitor at a time. • Can be instantiated using NEW and START statements. Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Condition Variable • Provides flexible synchronization among events than mutual exclusion • Has associated with it a queue of processes • Two operations: • wait conditionVariable • signal conditionVariable Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Process interaction Procedure oriented system Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Procedure Oriented System • Monitor has global data representing the state information for the resource • Number of procedure declarations representing the different services offered. • Attribute ENTRY used to seizing the monitor lock • Only means of interaction among its components is procedural Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Procedure Oriented System • Monitor NEW/ START • Global Data • Condition Variable Global Data is shared across multiple processes Process1 Monitor encapsulates the data and methods and provides synchronized data access Process3 Process2 Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Procedure Oriented System • Monitor NEW/ START • Global Data Locked by proc 1 • Condition Variable Procedure CALL A process should first acquire mutex for data, and then perform its operations. Process1 Process3 Process2 Procedure can wait (synchronous) Or proceed with its operations (asynchronous) Any other process requesting for mutex is queued. No other process is allowed to access the data if its locked Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Procedure Oriented System • Monitor NEW/ START • Global Data • Condition Variable Algorithm for Procedure 1 if Resource Exhausted then WAIT C Procedure CALL Process1 Process3 the process waits until some other process SIGNAL C Process2 Procedure 1 wakes up when data Is ready and Finishes Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Procedure Oriented System • Monitor NEW/ START • Global Data Unlocked by proc 1 • Condition Variable Process 1 releases the mutex Process1 Process3 Next process in the queue is scheduled. Process2 The data is operated by one process at a time Thus Synchronization is achieved! Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Characteristics Of both Systems Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Duality mapping Procedure-oriented Monitors, NEW/START External Procedure identifiers ENTRY Procedure call FORK/JOIN RETURN (from procedure) monitor Lock, ENTRY attribute ENTRY procedure declarations Condition variables, WAIT, SIGNAL Message-oriented Process, CreateProcess Message channels/ports SendMessage/AwaitReply (immediate) SendMessage/AwaitReply (delayed) SendReply Main loop of standard resource manager, WaitFor Message statement, case statement Arms of the case statement Waiting for messages Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Duality mapping Process, CreateProcess Monitors, NEW/START External SendReply RETURN (from procedure) Procedure identifiers ENTRY Message channels/ports Procedure call FORK/JOIN SendMessage/AwaitReply (immediate) SendMessage/AwaitReply (delayed) Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Duality mapping Lock, ENTRY attribute WAIT, SIGNAL ENTRY procedure declarations (which procedure) Arms of the case statement (which port) Main loop WaitFor Message statement, case statement Waiting for messages Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Similarity of Models • A system constructed with the primitives defined by one model can be mapped directly into a dual system, which fits the other model. • A client program written for one system can be transformed for the other system by replacing the primitives from the first model with the primitives of the other. • Logic of program not affected by transformation • None of the important parts are touched or rearranged • The semantic component is invariant • Only the syntax of primitives varies Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Preservation of performance Three important elements that affect performance • Execution time • Computational load • Queuing and Wait times The duality mapping doesn’t modify the main bodies of the programs • Speed of execution of a single program is same • Number of additions, multiplications, comparisons are same • So the amount of computing power is same • In a suite, the way in which the executions of those programs interact with others is same • Process wait time is same • Life time of computation is same Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Validation • No formal proof • Mixed acceptance among a (biased) peer community • Only one citable case: Cambridge CAP computer • Originally message-oriented • Switched to process-oriented, with little change • No attempt is made to rigorously prove their assertions Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
Conclusion • No inherent differences between the models • Choose model based on • Machine architecture • Programming environment • Both systems has its own merits, and it cannot be said one is better than the other. • Eliminates some degrees of freedom in the design process • This property of equivalence between two categories of operating system can be used in effective implementation of OS on a particular architecture based on performance calculation beforehand. Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011
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. • Thanks to Elizabeth Keniston CS 533 - Winter2009 • http://en.wikipedia.org/wiki/Event_(computing) • http://en.wikipedia.org/wiki/Message_passing • http://en.wikipedia.org/wiki/Interprocess_communication • http://en.wikipedia.org/wiki/Fork_(operating_system) • http://web.cecs.pdx.edu/~harry/Blitz/InstructorInfo/IdeasOnHoareTask.pdf • http://en.wikipedia.org/wiki/Monitor_(synchronization) • http://en.wikipedia.org/wiki/Monitor_(synchronization) • http://en.wikipedia.org/wiki/Duality_principle_(boolean_algebra)#Duality_principle Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011