------------------------------------------------------------------------------- Mohamed G. Gouda Homework 1 CS 356: Computer Networks Spring 2007 ----------------------------------------------------------------------------- 1. (3 Points): In the resource allocation protocol discussed in class, each resource can be accessed by at most one user at a time (and each user can access at most one resource at a time). Modify this protocol such that each resource can be accessed by at most three users at a time (but each user can still access at most one resource at atime). Specify the controller process c in the modified protocol. ----------------------------------------------------------------------------- 2. (3 Points): Consider a network that consists of a process p and a process array q[i : 0..n-1]. The communications in this network go through consecutive "rounds". In each round, first, p sends n rqst messages, one to each process q[i], then, p waits until for each i, i = 0..n-1, either p receives a rply message from q[i] or p is certain that either the rqst message from p to q[i] is lost, or the corresponding rply message from q[i] to p is lost. Process p in this network is specified as follows. process p const n var ready : boolean, {initially true} i : 0..n-1 begin ready --> S.0 [] rcv rply from q[i] --> S.1 [] timeout ~ready ^ (#ch.p.q[i] + #ch.q[i].p = 0) --> S.2 end Specify the three statements S.0, S.1, S.2 in process p. ----------------------------------------------------------------------------- 3. (4 Points): A network has m+n+1 processes: p[i : 0..m-1], q[j : 0..n-1], r. In this network, process r acts as a "switch" between the p[i] processes and the q[j] processes. At any time, a process p[i] sends a rqst(j) message to process r, then waits to receive a rply message from r before it can send another rqst(j') message to r. When r receives a rqst(j) message from p[i], r sends a rqst(i) message to q[j]. When q[j] receives a rqst(i) message from r, q[j] sends a rply(i) message to r. When r receives a rply(i) message from q[j], r sends a rply message to p[i]. Specify the proceses in this network. -----------------------------------------------------------------------------