CMPSCI 377: Operating Systems
Homework 2
Due: Oct 24, 2014
Note: Please submit your solutions via moodle.
- What is a condition varaible and explain a typical syncronization
scenario where it is used? Why does a condition variable involve releasing
a lock when going to sleep?
- Describe an example scenario where using an "if" statement instead of a while
when using condition variable can cause problems when using Mesa-style
monitor. Based on this example, explain why correct usage of condition
variable requires a "while" loop to check the condition for which the condition
variable is used.
- Why do Hoare-style monitors not require the while for condition variables?
- Explain why allowing multiple readers to read a shared
variable concurrently in the ReaderWriters problem will not impact
correctness so long as writers are blocked.
- Consider the dining philosophers problem discussed in Lecture 9, slide 18.
Explain what the putdown method is doing. Also explain how the the putdown
method wakes up a philosopher waiting for a fork.
- What are the four necessary conditions for a deadlock? Give a simple
example to show why these conditions are not sufficient.