Title: On the Duality of Operating System Structures
1On the Duality of Operating System Structures
- Hugh C. Lauer, Xerox Corporation, Palo Alto, CA
- Roger M. Needham, Cambridge University,
Cambridge, England
Tracy Wagner COP 6614 September 13, 2005
2Introduction
- Focus on OS Properties of
- Process
- Synchronization
- Interprocess Communication
- Two System Categories
- Message-oriented
- Procedure-oriented
3Message-oriented Systems
- Pass messages (events) easily and efficiently
among processes - Peripheral devices treated as processes
- Messages and message identifiers
- Queue messages at destination processes until
action can be taken - Synchronization and queuing implemented in
message queues - Processes operate on one message at a time
4Message-oriented Systems
- Specific communication paths
- Message Channels and Message Ports
- SendMessage, WaitForMessage, AwaitReply,
SendReply operations - Static number of processes and connections
- Process declarations
- CreateProcess operation
- Processes operate in a static context
- Priorities statically assigned
- Data structures passed by reference
5Producer/Consumer (Message-oriented)
- Consumer()
- int widget message m
- for(0 to N)
- sendMsg(producer, m) // send bufferSz
empty msgs -
- while (TRUE)
- awaitReply(producer, m) // get msg with new
item - extract_item(m, widget)
- sendMsg(producer, m) // reply with
empty msg - consume_item(widget) // consume the item
-
-
- Producer()
- int widget message m // message buffer
-
- while (TRUE)
- make_item(widget) // create
a new item
6Procedure-oriented Systems
- Simple process creation/deletion
- Processes inherit priorities dynamically
priorities associated with locks - Global naming schemes important
- Procedure protection mechanisms
- Synchronization and queuing implemented by
processes waiting for locks - Control of and interrupts from peripheral devices
by manipulation of locks and/or shared data
7Procedure-oriented Systems
- Efficient procedure calls
- Synchronous
- Asynchronous
- FORK and JOIN operations
- Synchronizing data structures
- Data shared directly among processes
- Condition variables
- WAIT, SIGNAL operations
- Processes typically have only one task
8Producer/Consumer (Procedure-oriented)
- monitor ProducerConsumer
- condition full, empty int count
-
- procedure enter()
-
- if (count N) wait(full) // if buffer is
full, block - put_item(widget) // put item in
buffer - count count 1
- if (count 1) signal(empty)// wake
consumer -
- procedure remove()
-
- if (count 0) wait(empty) // if buffer
empty, block - remove_item(widget) // remove
from buffer - count count - 1
- if (count N-1) signal(full)// wake
producer -
9Producer/Consumer (Procedure-oriented)
-
- Producer()
-
- while (TRUE)
-
- make_item(widget) // make a new item
- ProducerConsumer.enter // call enter in
monitor -
-
- Consumer()
-
- while (TRUE)
-
- ProducerConsumer.remove // call remove in
monitor - consume_item // consume an
item -
-
10System Comparison
- Message-oriented systems
- Passing messages only interaction
- Own address space
- Requests handled serially
- Procedure-oriented systems
- Procedural interaction
- Movement from context to context across module
boundaries - Depend on monitor locks and condition variables
11Mapping
Message-oriented
Procedure-oriented
Processes, CreateProcess
Monitors, NEW/START
Procedure identifiers, ENTRY procedure identifiers
Message Channels, Message Ports
SendMessage AwaitReply (immediate)
Simple procedure call
- SendMessage AwaitReply (delayed)
12Mapping
Message-oriented
Procedure-oriented
SendReply
RETURN from procedure
Lock, ENTRY attribute
Main loop, WaitForMessage statement, case
statement
ENTRY procedure declarations
Arms of case statement selective
- Condition variables, WAIT, SIGNAL
13Conclusions
- Models are Duals
- Similarity of Programs
- Identical Performance