Review questions

* 1. A mutex is just a kind of semaphore.

* 2. A semaphore is just a kind of mutex.

* 3. Suppose we initialize an integer variable: int lock = 0;
We will use this lock to control access to a critical section used by multiple threads:

while (lock == 1) { } /* If someone else has the lock, wait */
lock = 1;
critical_section();
lock = 0; /* If someone has the lock, wait */

Does this work correctly?

T