------------------------------------------------------------------------------- Mohamed G. Gouda CS 356 Summer 2006 Midterm 2 Solution ------------------------------------------------------------------------------- 1. process p const w var na, ns, i : integer {init. 0} begin na + w > ns -> if na = ns -> {send short msg} send data(ns) to q [] true -> {send long msg} send data(ns) to q fi; ns:= ns+1 ... (other actions are the same as the ones in the textbook) end ------------------------------------------------------------------------------- 2. rcvd[s], rcvdtxt[s] := true, t; do rcvd[exp] -> rcvd[exp], txt[x], exp, x := false, rcvdtxt[exp], exp + 2n 1, x+1 od -------------------------------------------------------------------------------