39
Hugh Lauer Xerox Corporation Roger Needham Cambridge University On the Duality of Operating System Structures Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

  • View
    219

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Hugh LauerXerox CorporationRoger Needham

Cambridge University

On the Duality of Operating System

Structures

Presented by

Vidhya Priyadharshnee Palaniswamy Gnanam

Spring 2011

Page 2: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Key ideasDuality PrincipleGoals and ApproachMessage Oriented SystemProcedure Oriented SystemCharacteristics

Duality mappingSimilarity of ModelsPreservation of performance

ValidationConclusionReferences

Presentation Outline

Page 3: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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.

Key ideas

Page 4: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Multiple Processes needs to perform operations on a single datao Data may segregated and  be specific to a process

(message oriented)o 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

Key ideas

Page 5: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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.

Duality Principle

Page 6: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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 hardwareEmpirical approach• Observation ,classification of properties, generalization

and construction of abstract models• Informal reasoning, empirical support• Conclusion about the class of objects

Goals and Approach

Page 7: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Message Oriented SYSTEm

Page 8: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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 communicationoDestination (Message Channels)oQueuing messages at destination processes

(Message Ports)  Primitive operations for message transmission

SendMessage, AwaitReply, WaitForMessage, SendReply

Model

Page 9: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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.

Features

Page 10: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Synchronization achieved by oProcesses queues for congested resources in

message queues attached to the processes associated with those resources.

oProcess 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

Good Design Practice

Page 11: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Process interactionMessage oriented system

Page 12: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Process 3

Process 2

Process 4Process 1

Message Oriented System

Data

Data

Data

Data

Page 13: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

P3

P4

P1

P3

P4

P1

Process 3

Process 2

Process 4Process 1

Message Oriented System

Data

Data

Data

Data

Message port1Message port2

Message port3P3

P4

P1

Processes have message ports to receive messages in queue

Page 14: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Process 3

Process 2

Process 4Process 1

Message Oriented System

Data

Data

Data

Data

 Each process has its own data.  

 A process operates on data contained by another process by means of explicit message passing mechanism

Page 15: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Process 3

Process 2

Process 4Process 1

Message Oriented System

Data

Data

Data

Data

Wait for Message()

Wait for Message()

Wait for Message()

The process containing the data receives request in the form of message.

All processes waits for Requests from other Processes in all its ports.

Page 16: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Process 3

Process 2

Process 4Process 1

Message Oriented System

Data

Data

Data

Data

SendMessage()

P3

P4

P1

Process 3 sends Request for Process 1Data.

The request isQueued in the messagePort of process1

Page 17: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Process 3

Process 2

Process 4Process 1

Message Oriented System

Data

Data

Data

Data

SendReply()

AwaitReply() The data is operated by the algorithm defined for that port which received the message  Result is sent back

 The requesting process can either block (synchronous)/ resume its operation (asynchronous) 

Page 18: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Process 3

Process 2

Process 4Process 1

Message Oriented System

Data

Data

Data

Data

P4

P1

Process 1 processes next message in the queue

Similar to Event handler mechanismAll process processes only one message at a time.

Thus synchronization is achieved!.

Page 19: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Procedure Oriented SYSTEM

Page 20: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

ProcedureoContains Algorithms, local data,

parameters, results Procedure call oSynchronous: the calling procedure blocks until

the called procedure returnsoAsynchronous: the calling procedure continues

execution along with the called procedure fork procedureName(parameterList)

Returns processID join processID

Returns (resultsList)

Model

Page 21: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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

Features

Page 22: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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

Good Design Practice

Page 23: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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.

Modules and Monitors

Page 24: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Provides flexible synchronization among events than mutual exclusion

Has associated with it a queue of processes Two operations:

◦ wait conditionVariable ◦ signal conditionVariable

Condition Variable

Page 25: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Process interactionProcedure oriented system

Page 26: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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

Procedure Oriented System

Page 27: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Procedure Oriented System

Global Data Condition

Variable

MonitorNEW/ START

Global Data is shared across multiple processes

Monitor encapsulates the data and methods and provides synchronized data access

Process1

Process2

Process3

Page 28: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Procedure Oriented System

Global Data Condition Variable

MonitorNEW/ START

Process1

Process2

Process3

A process should first acquire mutex for data, and then perform its operations.

Procedure CALL

Locked by proc 1

Any other process requesting for mutex is queued.No other process is allowed to

access the data if its locked

Procedure can wait (synchronous)Or proceed with its operations (asynchronous)

Page 29: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Procedure Oriented System

Global Data Condition

Variable

MonitorNEW/ START

Process1

Process2

Process3

Procedure CALLAlgorithm for Procedure 1

if Resource Exhaustedthen WAIT C

the process waits until some other process SIGNAL C

Procedure 1 wakes up when data Is ready and Finishes

Page 30: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Procedure Oriented System

Global Data Condition

Variable

MonitorNEW/ START

Process1

Process2

Process3

Process 1 releases the mutex

Unlocked by proc 1

Next process in the queue is scheduled.

The data is operated by one process at a timeThus Synchronization is achieved!

Page 31: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

CharacteristicsOf both Systems

Page 32: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Message-oriented

Process, CreateProcessMessage channels/portsSendMessage/AwaitReply

(immediate)SendMessage/AwaitReply

(delayed)SendReplyMain loop of standard resource

manager, WaitFor Message statement, case statement

Arms of the case statementWaiting for messages

Duality mappingProcedure-

oriented

Monitors, NEW/START ExternalProcedure identifiers ENTRY

Procedure call

FORK/JOINRETURN (from procedure) monitor

Lock, ENTRY attribute

ENTRY procedure declarationsCondition variables, WAIT, SIGNAL

Page 33: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Duality mapping

Process, CreateProcess Monitors, NEW/START External

Message channels/ports

Procedure identifiers ENTRY

SendMessage/AwaitReply (immediate)

Procedure call

SendMessage/AwaitReply (delayed)

FORK/JOIN

SendReplyRETURN (from procedure)

Page 34: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Duality mapping

Main loop WaitFor Message statement, case statement

Lock, ENTRY attribute

Arms of the case statement (which port)ENTRY procedure declarations (which procedure)

Waiting for messages

WAIT, SIGNAL

Page 35: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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

Similarity of Models

Page 36: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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

Preservation of performance

Page 37: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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

Validation

Page 38: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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.

Conclusion

Page 39: Hugh Lauer Xerox Corporation Roger Needham Cambridge University Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

Presented by Vidhya Priyadharshnee Palaniswamy Gnanam Spring 2011

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/IdeasOnHoa

reTask.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

References