Using synchronization primitives CS-3013 A-term 20088 Simulating Condition Variables in Kernel Space Condition variable = ( wait_count, semaphore ) Wait: while holding spinlock mon_lock wait_count++ spin_unlock(mon_lock) down(semaphore) spin_lock(mon_lock) Signal: while holding spinlock mon_lock if (wait_count > 0) { –up(semaphore) –wait_count -- } Question: is there a danger of a race condition between waiting and signalling?
{}