------------------------------------------------------------------------------- Mohamed G. Gouda CS 356 Summer 2008 Homework 1 ------------------------------------------------------------------------------- 1. A protocol involves a process array p[i : 0..n-1] and a process named medium. At each instant, any process p[i] can generate a bit(b) message, where b is either 0 or 1 and sends it to process medium. When process medium receives a bit(b) message from a process p[i], medium sends a copy of the message to each process in the process array. When a process p[i] receives a bit(b) message from process medium, p[i] stores the received b in the next available element of its array "rcvd" that is declared as follows: var rcvd : array [integer] of 0..1, x : integer {index of rcvd; init. 0} Specify the processes p[i : 0..n-1] and medium using the AP notation. Will arrays rcvd in all the p[i] processes become identical eventually? Explain your answer. ----------------------------------------------------------------------------- 2. Consider a protocol that consists of three processes p[i : 0..2]. The execution of this protocol proceeds in an infinite sequence of "rounds". In each round, each p[i] generates a random value y in the range 0..2 and sends it in a data(y) message to each of the other two processes, p[i +3 1] and p[i +3 2], in the protocol. After generating one value, in the range 0..2, and receiving two more values, in the same range, p[i] sums up the three values and takes modulo 3 and stores the result in the next available element of its array "round". An incomplete specification of process p[i : 0..2] is as follows. process p[i : 0..2] inp J : set { k | 0<=k<3 ^ k!=i } var round : array [integer] of 0..2, x : integer, {index of round; init. 0} y,z : 0..2, {init. 0} gen,rcvd: boolean {init. false} j : J {init. j = i +3 1 } begin ~gen --> [] rcv data(y) from p[j] --> end Specify statements S.0 and S.1. ------------------------------------------------------------------------------- 3. It is required to generalize the protocol in Problem 2 for the process array p[i : 0..n-1]. Specify the input and variables in each p[i] in the generalized protocol. -------------------------------------------------------------------------------