------------------------------------------------------------------------------- Mohamed G. Gouda Homework 1 CS 356: Computer Networks Summer 2007 ----------------------------------------------------------------------------- 1. (3 Points): It is required to design a network p[i : 0..3] as follows. At any time, process p[0] sends a rqst message to process p[1] then waits to receive a rply message from any of the processes p[i : 1..3] before it can send the next rqst message to process p[1]. When a process p[i], where i=1..3, receives a rqst message from process p[i-1], p[i] either forwards the rqst message to p[i+1], provided that i<3, or sends a rply message to process p[0]. Assuming that the communication in this network is error-free, specify process p[0] and processes p[i : 1..3]. ----------------------------------------------------------------------------- 2. (3 Points): Assuming that the communication in the network in problem 1 is error-prone, modify the processes in this network to ensure that the processes tolerate message corruption, message loss, and message re-order. ----------------------------------------------------------------------------- 3. (4 Points): Consider a network p[i : 0..n-1]. In this network, any two processes p[i] and p[g] are "neighbors" iff there are two oposite-direction channels between them and so they can exchange messages. At any time, a process p[i] in this network can attempt to start a "connection" with anyone of its neighbors p[g]. In this case, p[i] sends a rqst message to p[g], and p[g] either rejects the connection by sending message no to p[i], or accepts the connection by sending message yes to p[i]. Neighbor p[g] rejects the connection with p[i] if p[g] is already in an established connection with another neighbor (other than p[i]) or is attempting to start a connection with anyone of its neighbors. If p[g] accepts the connection with p[i], then the connection between p[i] and p[g] remains established until p[i] sends a done message to p[g] to terminate the connection. Each process in this network can be in at most one established connection at a time. Specify the actions of each process p[i] in this network assuming that the communication in the network is error-free and that the input, variables, and parameter in p[i] is as follows. process p[i : 0..n-1] inp N : set {g | p[g] is a neighbor of p[i]} var s : boolean, {p[i] is attempting to start a connection with p[g] or has started the current connection with p[g], init. false} e : boolean, {There is an established connection between p[i] and p[g], init. false} g : N par j : N -----------------------------------------------------------------------------