Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CS 6378, Spring 2005 Homework 1 (Due on February 10, 2005) 1. For consistent global state recording, we saw that the condition n >= m has to be satisfied for all pair of channels. (n being the number of messages having been recorded as sent and m being the number of messages recorded as having been received). However, we also discussed that FIFO (First In First Out) channel condition also needs to be satisfied (along with n >= m) for consistency. Give an example (in terms of a space-time diagram) on why you need the FIFO condition. (From lecture notes) n = 1; m = 1; However, if FIFO is not there, consistency is not satisfied. S1 M1 LS1 M2 S2 LS2 2. We saw that the message ordering algorithms (such as BSS, SES, modified SES) discussed in the class are not fault tolerant, e.g., tolerate a process crash or lost messages. Though handling fault tolerance is complex, can we make these algorithms handle graceful faults? For instance, can a process P1 exit gracefully from a system without causing problems to the message ordering algorithms. Such a graceful exit means that the process’s termination will not cause messages to be buffered indefinitely in other processes. For answering this question: Can you explain the condition(s) that need to be satisfied for a process’s termination not to cause any indefinite buffering of messages? (Assume that this process was an active one, i.e., it communicated with other processes regularly before it decided to terminate gracefully). Then, take the SES algorithm as a case study and explain how graceful exit of a process can be implemented in the algorithm. Answer: Main thing is to ensure all of P1’s earlier messages are received by their respective destinations. The modification to the algorithm can make P1 send a SignOff message to all processes in the system (or just to processes in V_P1 entry because they represent the possible destinations). The SignOff message is time stamped (with P1’s clock) and carries V_P1 too. P1 is NOT allowed to send any data messages after sending SignOff message. A process Pj (with a clock of TPj) receiving P1’s SignOff message checks: Compare the tuple <Pj,t> in V_M (i.e. the V_P1 carried by the SignOff message) If t <= TPj, then Pj has received all messages from P1 and P1 can be allowed to terminate and so Pj can send an OkToSignOff message back to P1. Else the SignOff message can be buffered until t <= TPj. When P1 collects the required number of OkToSignOff messages, it can terminate. This number is either the number of processes in the system (if the SignOff message is sent to everybody) or the number of entries in V_P1 (if it is sent only to those entries). (Other correct solutions will be given due credit). 3. Implementing Remote Procedure Calls (RPCs) in a distributed system require binding/registration server(s). When a server process supporting an RPC comes up, the process registers itself with the binding server specifying the name(s) of the RPC(s) it will be supporting. A client contacts the binding server with the name of RPC it wants to use. The binding server replies with the name (if needed), IP address, and port number of the required RPC server. As you can guess, the binding server can provide this sort of look-up service using a table. Can you design a simple table (i.e., the data structure) that could be used by a binding server? This table should allow multiple RPC servers to handle the same RPC. Answer: RPC NameI: <ServerNameX, IPAddressX, PortNumberX> <ServerNameY, IPAddressY, PortNumberY> ……. RPC NameJ: <ServerNameX, IPAddressX, PortNumberX> <ServerNameY, IPAddressY, PortNumberY> ……. RPC NameK: <ServerNameX, IPAddressX, PortNumberX> <ServerNameY, IPAddressY, PortNumberY> ……. 4. Consider the following space-time diagram of a system using the “original” SES (SchiperEggli-Sandoz) algorithm. S1 M1 M6 M4 S2 M2 M5 S3 M3 S4 a) Write down the time stamps of the messages M1 to M6 (e.g., Tm1 = <w,x,y,z>). Tm1 = <1,0,0,0>; Tm2 = <1,2,0,0>; Tm3 = <1,2,2,0> Tm4 = <0,0,0,1>; Tm5 = <1,2,2,3>; Tm6 = <4,2,2,3> b) Write down the contents of V_M6. V_M6 = [S2, <1,0,0,0>], [S1,<0,0,0,1>] Full credit also given for answer: V_M6 = [S2,<1,0,0,0>] giving one of the following reason: (i) only N-1 tuples in V_P entries and so V_S1 does not store its tuple. (ii) S1 deleted the tuple <S1,<…> 5. Mention True or False against each of the following statement. a) Transit messages are those recorded at the receiver but not at the sender. b) Inconsistent messages are recorded at the receiver but not at the sender. c) For global state consistency, number of messages recorded at the sender has to be less than or equal to that recorded at the receiver. d) For global state consistency, number of messages recorded at the sender has to be greater than or equal to that recorded at the receiver. Answer: (a) False (b) True (c) False (d) True 6. Which of the following features do you need in the system to support Exactly Once semantics for Remote Procedure Calls? (Do not ask me what is Exactly Once). a) Unreliable communication (e.g., UDP) b) Reliable communication (e.g., TCP) c) Reliable communication (e.g., TCP) + a commit protocol d) Unreliable communication (e.g., UDP) + a commit protocol Answer: (b) 7. Consider the following space-time diagram of a system using Lamport’s mutual exclusion algorithm. The arrow marks indicate critical section requests. Assume the time stamps of requests as follows: (S1, 5), (S2, 4), (S3, 7). Can any system enter into critical section at T1? Why? (Only 1 sentence allowed for the reason. More than 1 sentence, no credit will be given). (1 Mark) S1 S2 S3 (5) (4) (7) T1 Answer: S2 can since it has received a message with higher time stamp from other sites and its request is at the top of its queue. 8. If each process uses a different value for d in Eqs. 5.1, 5.2, and 5.3, will the logical clocks and vector clocks schemes satisfy the total order relation => and Eq. 5.5? Answer: (1) Logical clock does not satisfy 5.5 because if C(a)<C(b), then a->b is not necessarily true. No matter what d is chosen. (see pp. 103 in textbook) (2) Using a different value of d in Eqs. 5.1, 5.2, and 5.3 does not affect the property of vector clocks. So, equation 5.5 still holds. 9. In the SES protocol for causal ordering of messages, when can a pair (s, t) be deleted from the vector maintained at a site? Answer: When a message M from site S is delivered, if t < Tm (message time stamp), then (S,t) can be deleted since the local time on S is already greater than Tm. 10. Consider the causal message ordering algorithms: BSS (Birman-Schiper-Stephenson), “original” SES (Schiper-Eggli-Sandoz), and “modified” SES. What type of message time stamps do they use (vector of clock values OR vector of sequence numbers)? Why? (Proper reason is a must to get credit). Answer: BSS: vector of sequence numbers. Reason: receiver has to figure out whether it has received all the senders’ messages. Receive events are not counted as part of the message vector. “Original” SES: vector of clock values. Reason: receiver has to count the receive events also to know whether the earlier message indicated in the dependency information has already been received. “Modified” SES: vector of sequence numbers. Reason: the matrix identifies the sender and receiver uniquely, so it is sufficient to count the “sent” messages (receive events are not counted) 11. We saw in the class that the following is true for Cuts in a distributed system. A Cut is a consistent cut if and only if VTc[1] = VTc1[1], VTc[2] = VTc2[2],… , VTc[n] = VTcn[n]. Can you prove/explain why this is true? Answer: By definition, VTc[1] = max(VTc1[1], VTc2[1], …, VTcn[1]). If VTc[1] = VTc1[1], then VTc1[1] >= VTc2[1],…,VTcn[1]. This means the cut event C1 includes all the sent messages by the process P1 that have been recorded/marked as having been received by other processes P2…Pn. Hence, the cut event C1 leads to consistency. Let us assume that VTc[1] < VTc1[1]. This means some other process has recorded a receive event from 1 and 1 has NOT recorded that event => the cut is not consistent. However, we started with the fact that the cut is consistent. So VTc[1] < VTc1[1] is NOT true => VTc1 = VTc1[1]. Similar arguments hold for VTc[2] .. VTc[n].