1. process p const n inp m: integer {m>0} var conp : boolean, cansnd : 0..m, sp, sq : integer, x, y : integer, i : 0..n-1 begin ~conp -> send crqst(sp) to q[i] [] rcv crply(x, y) from q[i] -> if ~conp ^ sp=x -> conp, cansnd, sq := true, m, y [] conp V sp!=x -> skip fi [] conp -> if cansnd>0 -> send data(sp, sq) to q[i]; cansnd := cansnd-1 [] true -> send drqst(sp, sq) to q[i]; cansnd := 0 fi [] rcv drply(x,y) from q[i] -> if sp =x -> conp, sp, i := false, sp+1, any [] sp!=x -> skip fi end 2. Each message needs n parity bits and a sequence number in the range from 0 to 2m. So the minimum number of bits we need to add to each message is: n + ceiling(log2m). Note here ceiling(log2m) means: -- -- |log2m | | 2 | 3. S.0: send data(next, exp) to q S. 1: if exp = x -> {accept data} exp := exp + 1 (mod 2) [] exp!= x -> {discard data} skip fi; if next != y -> {generate new data} next := next+1 (mod 2) [] next = y -> skip fi S.2: skip