Guest User

Untitled

a guest
Jan 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. do {
  2. flag[i] = true
  3. turn = j
  4. while(flag[j] == true && turn == j){};
  5.  
  6. #enter critical section
  7.  
  8. flag[i] = false
  9.  
  10. #remainder
  11.  
  12. } while (true);
  13.  
  14. do {
  15. #push i into process queue
  16. queue.push i
  17. #busy wait until i is first
  18. while(queue.first != i){};
  19.  
  20. #enter critical section
  21.  
  22. #remove i from the queue and let the next process begin
  23. queue.pop
  24.  
  25. #remainder
  26.  
  27. } while (true);
Add Comment
Please, Sign In to add comment