Download presentation
Presentation is loading. Please wait.
Published byAryan Hagg Modified over 9 years ago
1
Prepare for Test 2
2
Synchronization Define semaphore and give algorithm Based on the traditional semaphore algorithms in the notes, show the value of semaphore TEST after each of the following operations: Assume TEST is currently 0 and P0 is blocked on TEST Operation Value of TEST Processes Blocked on TEST P1 executes P(TEST) _____________ _______________ P2 executes V(TEST)_____________ _______________ P3 executes P(TEST)_____________ _______________ P4 executes V(TEST)_____________ _______________
3
Understand, but do not memorize, the solution to the P/C problem ProducerConsumerBlockedens 1 none 3 0 1 2 Produce( ) none 3 0 1 3 P(e) 4 P(n) 5 P (s)
4
Suppose that a distributed system with four sites (S1, S2, S3, S4) has decided to use the Ricart-Agrawal distributed mutual exclusion algorithm to control entry to critical sections. Also suppose that the following REQUEST messages have been sent and received at all sites: REQUEST(1.4, 4); REQUEST(2.1,1), REQUEST(1.2, 2) where a request message has the form REQUEST(timestamp i, process i )) In what order will the above three critical section requests be executed, once all required messages have been sent and received? Answer: _________________________________________________ How many total messages must be sent for one critical section to be executed? Answer: ____________________
5
Given the vector timestamps TS 1 = (1, 2, 3) and TS 2 = (3, 2, 1). If TS 1 is the timestamp of an event a, and TS 2 is the timestamp of an event b, did a happen before b, b happen before a, or are a and b concurrent? Explain how you know this. Answer: ________________________ Given the Lamport timestamps C1(a) = 3, C1 (b) = 5, did event a happen before event b, event b happen before event a, or are a and b concurrent, or more than one of the above? Answer: __________________________ Given the Lamport timestamps Ci(a) = 3, Cj (b) = 5 (i != j), did event a happen before event b, event b happen before event a, or are a and b concurrent, or more than one of the above? Answer: __________________________
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.