2.23: To implement 'down', disable interrupts and check the variable you're decrementing. If >0, decrement it, enable interrupts, and continue. If =0, block and schedule another process, enabling interrupts. To implement 'up', disable interrupts and increment the variable. If a process was sleeping on this variable, wake it. Then re-enable interrupts. The essence of the answer is that testing and changing the variable has to be done with interrupts masked. 2.39: The algorithm that has optimal average turnaround is shortest job first. We therefore schedule them as 3, 5, 6, 9, with X inserted in the appropriate place. 2.42: The simplest solution is to give the boost only if the process was actually blocked waiting for user input. Other solutions include rate-limiting the priority boost or requiring some output before each input line -- output on such terminals was slow, no faster than 10-13 characters/second. Other answers are possible as well. 3.15: A deadlock is not possible. A process with two of the resources can run to completion. A process with one resource needs a second before it can run. Assume each process grabs one. Both will try for another. There are three, so there's one resource free;one of the requests will succeed. The other process will wait until the first is done.