Tuesday, August 4, 2009
But then, race conditions can happen in Petersen's approach too and even in the sleep/wake-up approach suggested in the producer-consumer (which share a read-write buffer) problem. That is where Djikstra's semaphores come in. Semaphores basically keep track of pending wake-up calls and account for each of them. Semaphore 'ups/downs' are analogous to 'wake-ups/sleeps' in the producer-consumer problem.