------------------------------------------------------------------------------- Mohamed G. Gouda CS 356 Spring 2007 Homework 3 ------------------------------------------------------------------------------- 1. (5 points) In a star network p[i:0..n-1], there are two opposite-direction channels between process p[0] and each of the processes p[1]..p[n-1]. The processes in this network are designed to maintain both local and global topology information. a) What is the local and global topology information that need to be maintained by each process in this network? b) Specify the middle process p[0] and each of the boundary processes p[i:1..n-1] in this network. c) Write down the condition that allows process p[1] to generate and send a data(2) message whose ultimate destination is process p[2]. (Hint: this condition involves both the local and global topology information in process p[1].) ------------------------------------------------------------------------------- 2. (5 points) The processes in a network p[i:0..n-1] send messages using flooding. Each sent message has two fields: data(h,dst) where h is the maximum number of hops that this message can still make, and dst is a boolean array of n elements such that dst[i] is true iff process p[i] is an ultimate destination of the data message. When a process p[i] receives a data(h,dst) from a neighbor p[g], p[i] first checks whether it is an ultimate destination of the message, in which case p[i] keeps a copy of the message. Then p[i] decrements h by 1 and checks whether the resulting h is larger than 0, in which case p[i] forwards a copy of the message to each up neighbor other than p[g]. Note that each ultimate destination of a message can end up with many copies of the same message. Process p[i] in this protocol is specified as follows: process p[i : 0..n-1] inp N : set {g | p[g] is a neighbor of p[i]}, up : array[N] of boolean var h : 0..n-1, dst : array[0..n-1] of boolean, j : 0..n par g : N begin true -> h, dst := n-1, any; dst[i] := false; {p[i] cannot be a destination} j := 0; do j < n ^ ~dst[j] -> j := j+1 od; if j = n -> skip [] j < n -> {send a copy of data(h,dst) to each up neighbor} S0 fi [] rcv data(h,dst) from p[g] -> S1 end Specify the two statements S0 and S1. -------------------------------------------------------------------------------