Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition #2

Open
dimas3452 opened this issue Nov 6, 2020 · 0 comments
Open

Race condition #2

dimas3452 opened this issue Nov 6, 2020 · 0 comments

Comments

@dimas3452
Copy link

interbench/interbench.c

Lines 733 to 738 in e612a65

while (1) {
wait_sem(&s->start);
post_sem(&ringthreads[post_to].sem.start);
if (!trywait_sem(&s->stop))
goto out;
}

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant