q1s04

advertisement
CS 6378, Spring 2004
Quiz 1. February 10, 2004
Student Name:
ID #:
Important:
a. Examination is for 5 marks. Duration: 20 minutes.
b. This exam paper has 5 multiple-choice questions.
c. You may use the blank page on the left hand side as well as at the end.
Multiple Choice Questions:
(1 Mark each)
1. Consider the following space-time diagram of a system using the “original” SES (SchiperEggli-Sandoz) algorithm. What are the contents of the dependency information in M4 and M5
(i.e., contents of V_M4 and V_M5)?
(1 Mark)
Answer: (b)
S1
M1
M4
S2
M5
M2
S3
M3
S4
a)
b)
c)
d)
e)
M4: Empty; M5: <s1,Tm4>
M4: Empty; M5: <s2,Tm1>
M4: <s4,Tm3>; M5: <s1,Tm4>
M4: <s2,Tm1>,<s3,Tm2>,<s4,Tm3>; M5: <s2,Tm1>,<s3,Tm2>,<s4,Tm3>, <s1,Tm4>
None listed here. Actual answer is (please write):
2. What are the contents of the dependency information in M4 and M5 using the “modified” SES
algorithm, i.e., the algorithm for multicast handling?
(1 Mark)
Answer: (a)
a)
b)
c)
d)
M4: <0100><0010><0001><1000>; M5: <0110><0010><0001><1000>
M4: <0000><0000><0000><1000>; M5: <0010><0000><0000><0000>
M4: <0000><0000><0001><1000>; M5: <0110><0000><0000><1000>
None listed here. Actual answer is (please write):
3. Which of the following fully describes inter-process communication in CSP?
a) Synchronous, explicit naming, strongly typed
b) Asynchronous, port naming, weakly typed
c) Asynchronous, explicit naming, strongly typed
d) Synchronous, explicit naming, no typing
(1 Mark)
Answer: (a)
4. Which of the following describes the criteria for consistent global state recording?
a) Number of messages recorded at sender >= that recorded at receiver; no need for FIFO
Channels. FIFO Channels are needed only for Chandy-Lamport’s algorithm.
b) Number of messages recorded at receiver >= that recorded at sender; no need for FIFO
Channels. FIFO Channels are needed only for Chandy-Lamport’s algorithm.
c) Number of messages recorded at sender >= that recorded at receiver + FIFO Channels
d) Number of messages recorded at receiver >= that recorded at sender + FIFO Channels
(1 Mark)
Answer: (c)
5. Which of the following describes the condition to be satisfied for a site to enter into the critical
section using Lamport’s algorithm?
a) A site should receive at least 1 message from all other sites + its request should be at the
top of its request queue.
b) A site should receive at least 1 message with a time stamp greater than its request from
all other sites + its request should be at the top of its request queue.
c) A site should receive at least 1 message with a time stamp greater than its request from
all other sites + its request should be at the top of the request queue of all sites.
d) A site should receive at least 1 message from all other sites + its request should be at the
top of the request queue of all sites.
(1 Mark)
Answer: (b)
Brief Descriptions of Algorithms
1. “Original” SES Algorithm:
Sending a Message:



Send message M, time stamped tm, along with V_P1 to P2.
Insert (P2, tm) into V_P1. Overwrite the previous value of (P2,t), if any.
(P2,tm) is not sent. Any future message carrying (P2,tm) in V_P1 cannot be delivered
to P2 until tm < tP2.
Delivering a message


If V_M (in the message) does not contain any pair (P2, t), it can be delivered.
/* (P2, t) exists */ If t !< Tp2, buffer the message. (Don’t deliver).
else (t < Tp2) deliver it
On delivering the message:



Merge V_M (in message) with V_P2 as follows.
 If (P,t) is not there in V_P2, merge.
 If (P,t) is present in V_P2, t is updated with max(t in Vm, t in V_P2).
Message cannot be delivered until t in V_M is greater than t in V_P2
Update site P2’s local, logical clock.
Check buffered messages after local, logical clock update.
2. Modified SES Algorithm:
Each node can maintain n x n matrix M, n being the number of processes.
Node i multicasts to j and k: increments Mi[i,j] and Mi[i,k]. M sent along with the message.
When node j receives message m from i, it can be delivered if and only if:
Mj[i,j] = Mm[i,j] - 1
Mj[k,j] >= Mm[k,j] for all k != i.
Else buffer the message
On message delivery: Mj[x,y] = max(Mj[x,y], Mm[x,y])
Download