ON THE DUALITY OF OPERATING SYSTEM STRUCTURES Hugh C. Lauer and Roger M. Needham Presented by: Ali R. Butt (adapted from many slides available online and.

Slides:



Advertisements
Similar presentations
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Advertisements

Extensibility, Safety and Performance in the SPIN Operating System Presented by Allen Kerr.
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Introduction CSCI 444/544 Operating Systems Fall 2008.
OS Organization 1 CS502 Spring 2006 A Note on Operating System Organization CS-502 – Spring 2006.
Big Picture Lab 4 Operating Systems Csaba Andras Moritz.
Concurrency, Thread and Event CS6410 Sept 6, 2011 Ji-Yong Shin.
Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6 Implementing Processes, Threads, and Resources.
1 On the Duality of Operating System Structures by Hugh C. Lauer, Xerox Corporation and Roger M. Needham, Cambridge University Presented by Scott Fletcher.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
CS533 Concepts of Operating Systems Class 6 The Duality of Threads and Events.
Concurrency CS 510: Programming Languages David Walker.
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
“Why Events are a Bad Idea (For high-concurrency servers)” Paper by Rob von Behren, Jeremy Condit and Eric Brewer, May 2003 Presentation by Loren Davis,
1 On the Duality of Operating System Structures Hugh Lauer, Xerox Roger Needham, Cambridge University Oct 1978, reprinted April 1979 Presented by David.
CS533 - Concepts of Operating Systems
On the Duality of Operating System Structures Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Yahia Mahmoud.
Communication in Distributed Systems –Part 2
Chapter 6 Implementing Processes, Threads, and Resources.
Multithreading in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 I/O Management in Representative Operating Systems.
Concurrency - 1 Tasking Concurrent Programming Declaration, creation, activation, termination Synchronization and communication Time and delays conditional.
PRASHANTHI NARAYAN NETTEM.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
On the Duality of Operating System Structures Hugh C. Lauer Xerox Corporation Roger M. Needham Cambridge University Presented By: Ashwini Kulkarni.
Processes CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Pattern Oriented Software Architecture for Networked Objects Based on the book By Douglas Schmidt Michael Stal Hans Roehnert Frank Buschmann.
Dave Archer - CS533 - Spring On the Duality of Operating System Structures Hugh C. Lauer, Roger M. Needham.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Threads and Processes.
Today’s Topics Introducing process: the basic mechanism for concurrent programming –Process management related system calls Process creation Process termination.
On the Duality of Operating System Structures 1. Hugh C. Lauer Xerox Corporation Palo Alto, Californi a Roger M. Needham Cambridge University Cambridge,
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
1 Concurrency Architecture Types Tasks Synchronization –Semaphores –Monitors –Message Passing Concurrency in Ada Java Threads.
CS533 - Concepts of Operating Systems 1 On The Duality of Operating System Structures Hugh Lauer, Xerox Roger Needham, Cambridge University 1979 Presented.
CSC321 Concurrent Programming: §5 Monitors 1 Section 5 Monitors.
Using a simple Rendez-Vous mechanism in Java
ICS 313: Programming Language Theory Chapter 13: Concurrency.
CS533 - Concepts of Operating Systems 1 The Mach System Presented by Catherine Vilhauer.
Middleware Services. Functions of Middleware Encapsulation Protection Concurrent processing Communication Scheduling.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
The Mach System Silberschatz et al Presented By Anjana Venkat.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
COT 4600 Operating Systems Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM.
REVIEW OF “ON THE DUALITY OF OPERATING SYSTEM STRUCTURES” Paper by Hugh C. Lauer and Roger M. Needham Presentation by Erin Chapman.
Constructs for Data Organization and Program Control, Scope, Binding, and Parameter Passing. Expression Evaluation.
Channels. Models for Communications Synchronous communications – E.g. Telephone call Asynchronous communications – E.g. .
Big Picture Lab 4 Operating Systems C Andras Moritz
Introduction to Operating Systems Concepts
Processes and threads.
On the Duality of Operating System Structures
Concurrency, threads, and events
CS533 Concepts of Operating Systems
Operating Systems: A Modern Perspective, Chapter 6
COP 4600 Operating Systems Fall 2010
On the Duality of Operating System Structures
Threads Chapter 4.
Channels.
Hugh Lauer Xerox Corporation Roger Needham Cambridge University
Channels.
On the Duality of Operating System Structures
CS533 Concepts of Operating Systems Class 4
Presentation transcript:

ON THE DUALITY OF OPERATING SYSTEM STRUCTURES Hugh C. Lauer and Roger M. Needham Presented by: Ali R. Butt (adapted from many slides available online and in previous offerings of the class)

Overview OS designs fall into two models – Message-oriented systems – Procedure-oriented systems These models are duals of each other – Constructs have direct counterparts – Programs are logically equivalent – Performance doesn’t differ between models

Why this work was needed? Settle the “Religious argument” over OS design choices 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 Follow an “Empirical” = “Engineering” approach – Observation and generalization – Informal reasoning, empirical support – Conclusion 3

Model I: Message-Oriented System System for passing messages easily Creates message queues for processes Processes are given operations for – Sending a message – Waiting for any messages – Waiting for a particular type of message – Examining the queue Pre-emption when message arrives at a higher priority process

Systems Have… Specific communication paths between processes Static number of processes Static number of connections between processes Processes execute in static context – No shared memory

Systems with Good Design Process associated with a resource implements synchronization and queuing for it If more than one process needs a data structure, pass by reference Peripheral devices treated as processes Static process priority Process works on one message at a time

Environment: Structures Messages: data structure for sending information Message Identifiers: handle to identify a particular message Message Channel: Identifies destination of a message Message Port: Queue for holding messages of a certain type for a particular process

Environment: Message Transmission SendMessage(messageChannel, messageBody) – Returns messageID AwaitReply(messageID) – Returns messageBody WaitForMessage({set of messagePort}) – Returns (messageBody, messageID, messagePort) SendReply(messageID, messageBody)

Environment: Processes Process Declaration – Local data and algorithms – Message ports – Message channels for other processes CreateProcess Operation

Message-Oriented System 10 begin m : messageBody i: messageId; p:portId; s: set of portId; initialize; do forever; [m,i,p] <- WaitForMessage[s]; case p of port1 =>...; --algorithm for port1 port2 =>... if resourceExhausted then s <- s - port2; SendReply [i, reply];...; --algorithm for port2... portk =>... s <- s + port2...; --algorithm for portk endcase endloop end. { ResourceManager(int n) { // initialize } run() { while (true) { msg = WaitForMessage (s); p = msg.getPort (); if ( p == acquire ) { r = resourceAvailable.pop (); if (resourceAvailable.empty() ) s.remove (acquire); msg.sendReply( r ); } else if (p == release) { resourceAvailable.push( (Resource) msg.getBody()); s.add (acquire); } } // endloop (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) [ Example Code in Java style ] class ResourceManager extends Thread

Model II: Procedure-Oriented System Protection and addressing mechanism Efficient procedure calls Cooperation between processes done through locked data structures Pre-emption when a higher priority process gets a lock it was waiting on

Systems Have… Global data is protected and easily accessed Process creation is efficient and easy Processes have one goal but may wander through the system to do it

Systems with Good Design Synchronization done through locks on data structures – A process will lock only small amounts at one time Data is shared between processes Peripherals are controlled by locks and shared memory Processes have dynamic priorities Global naming scheme often used

Environment: Procedures Procedure – Algorithms – Local data – Parameters – Results

Environment: Procedure Calls Synchronous Asynchronous – fork procedureName(parameterList) Returns processID – join processID Returns (resultsList)

Environment: Modules and Monitors Module: primitive unit of compilation – Procedures – Data Monitor: special module protected by a lock – Only one process can execute it at a time Module Instantiation – new – start

Environment: Condition Variables Must be in a monitor Associated queue of processes Operations: – wait conditionVariable – signal conditionVariable

Procedure-Oriented System 18 synchronized Resource acquire() { while (resourcesAvailable.isEmpty()) try { wait(); } catch (InterruptedException ie) { } return resourcesAvailable.pop(); } synchronized void release(Resource r) { resourcesAvailable.push(r); notify(); } ResourceManager:MONITOR = c: CONDITION; resourceExhausted:BOOLEAN; proc1:ENTRY PROCEDURE[...] =...;--algorithm for proc1 proc2:ENTRY PROCEDURE[...] RETURN[...] = BEGIN IF resourceExhausted THEN WAIT c;... RETURN[results]; END;... procL:ENTRY PROCEDURE[...] = BEGIN...; resourceExhausted <- FALSE; SIGNAL c;...; END; endloop initialize; END. [ Example Code in Java style ] ResourceManager (int n) { resourcesAvailable = new Stack (); for (int i = 1; i <= n; i++) { resourcesAvailable.push( Rsc Obj ); }

Duality Mapping EQUIVALENCE OF THE MODELS

The Duality Mapping Process, CreateProcess Message channels, Message Ports SendMessage; AwaitReply; (immediate) Monitors, new/start Procedure identifiers, entry Procedure identifiers Procedure call Message-Oriented SystemProcedure-Oriented System

The Duality Mapping SendMessage; … AwaitReply; (delayed) SendReply fork; … join; return (from procedure) Message-Oriented SystemProcedure-Oriented System

The Duality Mapping Main loop of standard resource manager, WaitForMessage, case statement Arms of the case statement selective Lock, entry attribute entry Message-Oriented SystemProcedure-Oriented System

The Duality Mapping Waiting for messages Condition variables, wait, signal Message-Oriented SystemProcedure-Oriented System

Similarity of the Models Programs can be transformed using the duality mapping Logic of program not affected by transformation This only works if the strict model employed in the paper is used

25 The duality Mapping & Similarity Message-oriented system structureProcedure-oriented system structure SendMessage & AwaitReply / SendReply main loop of standard resource manager, WaitForMessage statement case statement arms of the case statement Selective waiting for messages Synch & asynch procedure calls / RETURN monitor lock, ENTRY attribute ENTRY procedure condition variables, WAIT, SIGNAL

26 Message-oriented system structureProcedure-oriented system structure SendReplyRETURN ( from procedure )

27 Message-oriented system structureProcedure-oriented system structure WaitForMessage arms of the case statement monitor lock, ENTRY attribute

28 Message-oriented system structureProcedure-oriented system structure Selective waiting for messages condition variables, WAIT, SIGNAL The duality Mapping & Similarity (contd.)

Preservation of Performance EQUIVALENCE OF THE MODELS

Same Execution Characteristics Execution time Computational load Queuing Wait times Execution time of system primitives

Program Unchanged by Transform Same… – Execution speed – Amount of information stored – Amount of code Interaction between programs doesn’t change Total lifetime computation is the same

33 Welsh’s “Event-Driven Server” Request FSM Scheduler Disk Network Producer Consumer Event Queue Small number of threads Event queues Processing organized in “handlers” Server maintains continuation state

34 Lauer’s Message-Oriented OS Producer Consumer Send Wait WaitReply SendReply Channel Ports 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

35 Welsh’s “Threaded Server” Request 1 Request 2 Request 3 Request 4 Request 5 Dispatcher Network Producer Consumer Protected, Shared Data Large, dynamic thread count Shared data structures Processing organized in threads Thread maintains state

36 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 Producer Consumer Signal Wait

Producer Consumer Send Wait WaitReply SendReply Channel Ports Execution “Stream” Data “Stream” Producer Consumer Signal Wait Execution “Stream” Data “Stream”  - dual operations          

Conclusions Little empirical support No inherent differences between the models Choose model based on – Machine architecture – Programming environment Eliminates some degrees of freedom in the design process