Week 11
Week 11
Lecture 1
CS380D—Distributed Computing
The University of Texas at Austin
Coöperation
Asynchronous—concurrent processes
execute without relative bounds on the
speed between processes, and a process’s
speed may vary over time.
Failstop—processes may fail by halting at
any time.
Concurrent Data Structures
A concurrent object is a data A
structure shared by concurrent G
processes. push(E) B
ok
D
pop() LIFO
A Queue
push(F)
ok
Mutual Exclusion
push(E)
push(E)
A ok
ok
pop() G
pop()
B
E D E
An implementation of an object A is a
concurrent system {F1... Fr ; R}
the Fi are called front-ends
object R is called the representation object
The external events of the implementation
are just the external events of A.
The Fi share no events; they only
communicate through R
A Consensus Protocol is...
Consensus
Object
Number
1 atomic read/write registers
2 test&set, fetch&add
2n - 2 n-register assignment
{
val prev = *addr;
if (prev == old) { *addr = new; }
return prev;
}
value_t decision = ⊥;
value_t decide( value_t input) {
first = CAS( &decision, ⊥, input);
if ( first == ⊥ ) // CAS succeeded?
return input;
else
return first;
}
Wait-Free Synchronization
Lecture 2
CS380D—Distributed Computing
The University of Texas at Austin
Summary so far...
State diagram:
(L-op, L-first) (R-op, R-first)
SL S⊥ SR
(L-op, L-first) (L-op, R-first)
(R-op, L-first) (R-op, R-first)
old &A
new &B
Is this implementation correct?
old &A
new &B
Is this implementation correct?
Pop() qhead 0
do
old = qhead;
new = old->link;
cc = CAS(qhead, old, new);
until (cc == old);
return old;
old &A
new &B
Is this implementation correct?
old &A
new &B
Is this implementation correct?
Pop()
do
old = qhead;
link_field = &(old->link);
new = *link_field;
cc = CAS2(qhead, *link_field,
old, new, new, new);
until (cc);
return old;
do
old = qhead;
new = old->link;
cc = CAS(qhead, old, new);
until (cc == old);
return old;
Safe Memory Reclamation