------------------------------------------------------------------------------- Mohamed G. Gouda CS 356 Summer 2008 Midterm 3 ------------------------------------------------------------------------------- 60 minutes Open Book ------------------------------------------------------------------------------- 1. (10 points) A protocol involves the processes: p, q, and r[i : 0..n-1]. In this protocol, process q is the only neighbor of process p, and the only neighbor of each process r[i]. The function of this protocol is to allow process p to maintain a boolean array net[i : 0..n-1] such that the value of each element net[i] in the array is true iff all the channels between process p and process r[i] are up. An incomplete specification of processes p and q follows: process p const n inp up : boolean {two channels between} {p and q are both up?} var net : array [0..n-1] of boolean, v : array [0..n-1] of boolean, ts, t : integer, {init. 0} m : 0..n begin ... end process q const n inp up : boolean, {two channels between} {p and q are both up?} upr : array [0..n-1] of boolean {two channels between} {q and each r[i] are up?} var ts : integer {init. 0} begin up --> ... end Complete the specifications of p and q. ------------------------------------------------------------------------------- 2. (10 points) A routing protocol involves the processes p[i : 0..m-1, j : 0..n-1] where each process p[i,j] is said to "belong to group i". The processes generate data messages and route them. Each generated data message has one field x in the range 0..m-1. The ultimate destination of a generated data(x) message is any process p[x,j] that belongs to group x. Each process p[i,j] has three input arrays specified as follows: process p[i: 0..m-1, j : 0..n-1] inp N : set {(i',j')| p[i',j'] is a neighbor of p[i,j]}, up : array [N] of boolean grp : array [0..m-1] of N The value of grp[x] is the indices of the best neighbor of p[i, j] for reaching a process that belongs to group x. Specify process p[i,j]. -------------------------------------------------------------------------------