Skip to content

Race condition #2

@dimas3452

Description

@dimas3452

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions