string s = "" instaprint(ch): if(ch == 'a'): print('a') handle(ACK, None) else asend(proc[ch], (Authoritative, None)) handle(c, string): if c == None or c == Request: // kickstart the print process without a cascading ACK at the beginning emptyQueue = s == "" s += string if emptyQueue: instaprint(s[0]) else if c == ACK: s = s[1:] if s != "": instaprint(s[0]) proc[x]: x='a' while True: c, string = arecv(*) handle(c, string) proc[x]: x='b',...,'z' while True: (c, string) = arecv(*) if c == None asend(proc['a'], (Request, string)) else if c == Authoritative: print(x) asend(proc['a'], (ACK, None))