----------------------------------------------------------------------------- Mohamed G. Gouda CS 356 Spring 2008 Midterm 3 ----------------------------------------------------------------------------- Open Book Time: 1 hour ----------------------------------------------------------------------------- 1. (10 points) In a process array p[i : 0..n-1], process p[0] periodically initiates a flood by sending a copy of the message data(t, txt, d) to each one of its up neighbors, where t is the integer timestamp of the message, txt is the integer text of the message, and d is the "destination indicator" of the message in the range 0..1: If d=0 then every process p[i], where i is even and larger than 0, should accept the message text and every process p[i], where i is odd, should ignore the message text. If d=1 then every process p[i], where i is odd, should accept the message text and every process p[i], where i is even, should ignore the message text. When a process p[i : 1..n-1] receives a message data(t, txt, d) from a neighbor p[g], p[i] first checks whether it has received this message earlier and, if so, it discards the message. Otherwise, p[i] checks whether or not to accept txt and then p[i] forwards a copy of the received message to each one of its up neighbors, other than p[g] and p[0]. Specify process p[i : 1..n-1] in this protocol. Add the two comments {accept txt} and {ignore txt} where appropriate in your specification. ----------------------------------------------------------------------------- 2. (10 points): Consider a process array p[i : 0..4] where each of the following two processes are neighbors: {p[0], p[1]}, {p[0], p[2]}, {p[1], p[2]}, {p[1], p[3]}, {p[2], p[3]}, {p[2], p[4]}, {p[3], p[4]}. Each process p[i] in this array has a random routing table rtb that is declared as follows. inp N : set { g | p[g] is a neighbor of p[i]}, rtb : array [0..4, 0..1] of N (Recall that rtb[d, 0] and rtb[d, 1] store the two best neighbors of p[i] for reaching the ultimate destination p[d].) Specify what should be stored in rtb[0, 0..1] in each process in the process array so that no routed data message whose ultimate destination is p[0] ever go through a cycle. ------------------------------------------------------------------------------