Practice Midterm
All of the above
True
False
All of the above
True
False
Events e1 and e2 may be causally related
Event e1 happened before e2 in real time
i. Mark events c, f, and i with Lamport timestamps:
c (3, 1)
f (3, 3)
i (5, 4)
ii. Mark events c, f, and i with vector timestamps:
c [3, 0, 0, 0]
f [1, 1, 1, 0]
i [1, 1, 2, 2]
iii. List the event(s) v that are concurrent with e, i.e., v || e:
C, F, G, I, H
iv. List the event(s) v that Happened-Before g, i.e., v → g:
F, D, A
i. (2 points) What is the purpose of the buffered channel ‘C’ in this program?
‘C’ is is used to limit throughput. The buffer size ‘N‘ corresponds to the maximum number of outstanding requests that can be processed concurrently
ii. (2 points) Is there a potential problem in the above code?
Serve creates a new goroutine for every incoming request even though only
‘N’ of them can run at a time. As a result, the program can consume unlimited resources
if requests come in too fast
Solution: Two threads access the same data (user’s info) without synchronization, which
is dangerous. A possible fix would be to add locking around lines 10 - 13 and line 19.
N(N-1)
That any process can start the snapshot process
The receiver processes
A distributed systems technique for achieving fault tolerance and availability
False
Solution: RSMs and State Transfer are totally different approaches to Primary-Backup replication. RSM servers exchange commands (i.e., operations on state) whereas State Transfer approaches exchange the actual state (or parts of it).
False; random