------------------------------------------------------------------------------- Mohamed G. Gouda CS 356 Summer 2008 Homework 2 ------------------------------------------------------------------------------- 1. (5 points) A voting protocol consists of a process u and a process array v[i : 0..n-1]. The execution of this protocol proceeds in an infinite sequence of "rounds". In each round process u sends a vrqst message to each v[i] process which replies by sending back a vote(b) message, where b is in the range 0..1. If u receives n vote(0) messages in a round, then u records the value 0 in the next available element of its result array. On the other hand, if u receives at least one vote(1) message in a round, then u records the value 1 in the next available element of its result array. The constant, variables, and parameter of process u are specified as follows. process u const n var result : array [integer] of 0..1, x : integer, {index of result, init.0} ready : boolean, {init. true} voted : array [0..n-1] of boolean, num : 0..n, {number of u[i] who voted} k : 0..n, b : 0..1 par j : 0..n-1 Specify processes u and v[i : 0..n-1] under the assumption that sent messages can be lost but are neither corrupted nor reordered. ------------------------------------------------------------------------------ 2. (5 points) Modify the connection protocol that uses connection identifiers in Section 6.2 such that when process q receives a data message from process p, then q executes one of the following: a. q accepts the received data message and sends a data message to p. b. q accepts the received data message. c. q discards the received data message and sends a drpy message to p. Also when process p receives a data message from process q, then p executes one of the following: a. p accepts the received data message. b. p discards the received data message. Specify processes p and q in the modified protocol. ------------------------------------------------------------------------------