Forum: Computer Science Apr 15th, 2008 |
| Replies: 5 Views: 1,092 I agree that busy wait is not good, but I could think of one rare situation that a process wants to busy wait instead of blocking:
When a process greedily wants to capture an event as soon as... |
Forum: Computer Science Apr 15th, 2008 |
| Replies: 2 Views: 732 a = b = 0 # shared counters
sem(0) # semaphore initialized to 0
func_A: # code for type A process
a = a + 1
sem.V
func_B: # code for type B process
b = b + 1
sem.V |