













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: Newman; Class: DIST OPER SYS PRINC; Subject: COMPUTER PROGRAMMING; University: University of Florida; Term: Fall 2009;
Typology: Study notes
1 / 21
This page cannot be seen from the preview
Don't miss anything!














multiple processor system
LWP LWP LWP LWP
Heavy-weight process Heavy-weight process
User space threads
Light-weight processes
Kernel space threads
Synchronous Process, Asynchronous Communication, Time-Space
Graph representations
precedence relations
communication channels
one - way
client / server
peer
Synchronous process graph (^) communication scenarios
Asynchronous process graph and
Physical clock
A distributed time service architecture
TS
TS TS TC
TC
Distributed Time Service
Client Time Clerks
T ime Servers
External UTC Sources
Time Discrepancies
Lamport Logical Clock
The happens-before relationship: →
For it to be possible for a to have an influence on b, then a → b must be true.
Implementation:
C(b) = C(a) + d and Cj (b) = max(T Sa + d, Cj (b)), where T Sa is the timestamp of the sending event and d is a positive number.
So, a → b =⇒ C(a) < C(b), but C(a) < C(b) =/⇒ a → b.
Matrix Logical Clock
MCi represents Pi’s knowledge of its local events (MCi[i, i]), its knowledge of the events that Pj knows about (MCi[i, j]), and its knowledge of Pj ’s knowledge of events at Pk (MCi[j, k]). MCi[i, i] = MCi[i, i] + d – Pi updates local event counter on send
When Pj receives a message from Pi with timestamp T S, MCj [j, l] = max(MCj [j, l], T Si[i, l]) : l = 1..n update vector clock, and
MCj [k, l] = max(MCj [k, l], T Si[k, l]) : k = 1..n, l = 1..n update Pk’s knowledge of Pl’s counter
i
i
i,i
j j
Pi’s Vector Clock
Pj’s Vector Clock
k Pi’s knowledge of Pk’s Vector Clock k Pj’s knowledge of Pk’s Vector Clock
i
TS = MCi MCj
Pj’s knowledge of Pi’s Vector Clock
Pi’s knowledge of Pj’s knowledge of Pi’s Lamport Clock
elementwise max merge
Language constructs
Example: the Reader/Writer Problems synchronization + concurrency
Basics
Variations
Semaphore solution to the weak reader preference problem
var mutex=1, db=1: semaphore; rc=0: integer
reader processes writer processes
do (forever) do (forever) BEGIN BEGIN
otherStuff() otherStuff()
P(mutex) rc := rc + 1 if rc = 1 then P(db) P(db) V(mutex)
read database write database
P(mutex) rc := rc - if rc = 0 then V(db) V(db) V(mutex)
CCR solution
var db: shared; rc: integer;
reader processes writer processes
region db begin rc := rc + 1 end; region db when rc = 0 read database begin write dat abase end region db begin rc := rc - 1 end;
Serializer solution
rw : serializer var readq, writeq: queue; rcrowd, wcrowd: crowd;
procedure read begin enqueue(readq) until empty(wcrowd); joincrowd(rcrowd) then begin read database end; end
procedure write begin enqueue(writeq) until (empty(wcrowd) and empty(rcrowd)); joincrowd(wcrowd) then begin write database end; end
Path Expression solution
path 1:([read],write) end
Mutual exclusion using asyn. msg. passing
process Pi channel server process Pj begin begin begin receive(channel) create channel receive(channel) critical section send(channel) critical section send(channel) manage channel send(channel) end end end
Mutual exclusion using syn. msg. passing
process Pi semaphore server process Pj begin loop begin send(sem,msg) receive(pid,msg) send(sem,msg) critical section send(pid,msg) critical section receive(sem,msg) end receive(sem,msg) end end
A taxonomy
synchronization and communication mechanisms
shared variable message passing
type abstraction
control structure
program structure
monitor CCR Path
asynchronous
direct process naming
procedure naming
indirect port/mailbox naming
synchronous
request / reply (passive)
rendezvous (active)
process naming
procedure naming
process naming
procedure naming
RPC
asynchronous RPC
rendezvous form of RPC
Concurrent Pascal
Path Pascal
PLITS Gypsy CSP ADA Argus (^) DP DP Concurrent C
SR
SR
X- window sockets
embedded in many OS
DP none
asymmetric symmetric
Coordination languages
concurrent programming language concurrent programming language concurrent programming paradigm
OCCAM
SR
LINDA
processes
resources
distributed data structures
static global channels dynamic capabilities associative tags
System Object model Channel naming