Advertisement
peepraeza

Untitled

Sep 21st, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. do {
  2. waiting[i] = TRUE; key = TRUE;
  3. while (waiting[i] && key) key = Swap(&lock, &key);
  4. waiting[i] = FALSE;
  5. / critical section /
  6. j = (i+1) % n; while ((j != i) && !waiting[j])
  7. j = (j+1) % n;
  8. if (j == i) lock = FALSE; else waiting[j] = FALSE;
  9. n/ remainder section /
  10. while (TRUE);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement