interbench icon indicating copy to clipboard operation
interbench copied to clipboard

Race condition

Open dimas3452 opened this issue 5 years ago • 0 comments

https://github.com/ckolivas/interbench/blob/e612a65ce941028ddea804e6b45ccde2750720d2/interbench.c#L733-L738

A race condition is possible for ring load. Suppose that there are two ring threads '0' and '1'. Consider the following case:

  • '0' thread has executed the final post_sem(&ringthreads[post_to].sem.start); and finished.
  • '1' thread has received the final start, but it hasn't received stop yet, and '0' thread has already finished, so '1' thread hangs in wait_sem(&s->start); forever.

dimas3452 avatar Nov 06 '20 15:11 dimas3452