Exercises 3.46-49: mutexes, semaphores, and deadlock - no sols!