Practice Midterm

Pasted image 20251014022126.png
All of the above
Pasted image 20251014022146.png
True
Pasted image 20251014022203.png
False
Pasted image 20251014022310.png
All of the above
Pasted image 20251014022357.png
True
Pasted image 20251014022406.png
False
Pasted image 20251014022434.png
Events e1 and e2 may be causally related

Pasted image 20251014022731.png
Event e1 happened before e2 in real time
Pasted image 20251014022838.png
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

Pasted image 20251014023639.png
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
Pasted image 20251014025404.png
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.
Pasted image 20251014025439.png
N(N-1)
Pasted image 20251014025505.png
That any process can start the snapshot process
Pasted image 20251014025540.png
The receiver processes
Pasted image 20251014025648.png
A distributed systems technique for achieving fault tolerance and availability
Pasted image 20251014025803.png
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).
Pasted image 20251014025948.png
False; random