Message buffer[N] Int in=0, out=0 send(message msg) while in-out==N do nothing buffer[in modulo N]=msg in=in+1 return message recieve() while in == out do nothing msg = buffer[out modulo N] out=out+1 return msg
This is a code for a producer consumer problem. The producer produces a message and with the send function saves it into the buffer. The consumer receives that message from the buffer. The buffer, in and out are global variables. Where is the race condition here? I can't find any?