






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Struble; Class: Operating Systems; Subject: Computer Science; University: Virginia Polytechnic Institute And State University; Term: Fall 2000;
Typology: Study notes
1 / 30
This page cannot be seen from the preview
Don't miss anything!























n Execute two or more pieces of code "at the same time“ n Why? n No choice: n Geographically distributed data n Interoperability of different machines n A piece of code must "serve" many other client processes n To achieve reliability n By choice: n To achieve speedup n Sometimes makes programming easier (e.g., UNIX pipes)
Example 1: Unix pipes Motivations:
n What primitives should OS provide?
n What primitives should the OS provide to the interface communication protocol?
n Needed to implement OS primitives
n interleaved, or n physically simultaneous
n Multi-programming on uniprocessor
n Uni- or multi-programming on multiprocessor
n Scheduleable unit of computation
n Process "size" or computation to n Communication ratio n Too small: excessive overhead n Too large: less concurrency
S
S
S
Read set of Si: R (Si) = { a1, a2, ..., an } Set of all variables referenced in Si
Write set of Si: W (Si) = { b1, b2, ..., bm }, Set of all variables changed by Si
The following conditions must hold for two statements S1 and S2 to execute concurrently with valid results:
FORK and JOIN FORK and JOIN FORK L Starts parallel execution at the statement labelled L and at the statement following the FORK
JOIN Count Recombines 'Count' concurrent computations
Count := Count - 1; If ( Count > 0 ) Then Terminate computation Join is an atomic operation. else continue
Begin PARBEGIN A := X + Y; B := Z + 1; PAREND; C := A - B; W := C + 1; End;
Begin PARBEGIN A := X + Y; B := Z + 1; PAREND; C := A - B; W := C + 1; End;
Begin S1; PARBEGIN S3; BEGIN S2; S4; PARBEGIN S5; S6; PAREND; End; PAREND; S7; End;
Begin S1; PARBEGIN S3; BEGIN S2; S4; PARBEGIN S5; S6; PAREND; End; PAREND; S7; End;
n Within the monitor, Condition Variables are declared n A queue is associated with each condition variable n Only two operations are allowed on a condition variable: The procedure performing the wait is put on the queue associated with x If queue is non-empty: resume some process at the point it was made to wait
X.wait X.signal
ADT’s condition variables Proc1 queues Proc Proc
queue
ßQueue to enter monitor via calls to procedures ßQueues within the monitors via condition variables ßADTs and condition variables only accessible via monitor procedure calls