CS411/511. Operating Systems

Homework 4 - Solutions


Chapter 6: Review Questions 6.1, 6.4, 6.18

511 students only: 6.19


6.1.

6.4.Note that this is the same principle as Dekker's Algorithm, which we studied in class. It was a slightly earlier version, and therefore is more complicated than it really needs to be.

To prove that this algorithm is correct, we need to show that mutual exclusion is preserved, the progress requirement is satisfied, and the bounded-waiting requirement is met.

6.18. Note that the authors are referring to "cost" very generally (as in cost/benefit analysis), rather than specifically to "price."

6.19. If there is no checkpointing, the entire log must be searched after a crash, and all transactions "redone" from the log. If checkpointing is used, most of the log can be discarded. Since checkpoints are very expensive, how often they should be taken depends upon how reliable the system is. The more reliable the system, the less often a checkpoint should be taken.

When no failure occurs, the cost of checkpointing is "pure overhead" and can degrade performance if checkpointing is done frequently. When a system crash occurs, recovery time is proportional to the number of transactions since the last checkpoint. Assuming that a disk crash means the checkpoint file has been lost, recovery will involve a full rollback and re-doing of all transactions in the log.


Chapter 7: Review Questions 7.4, 7.6, 7.8, 7.13

(hint for 7.4(b): this is what drivers are really supposed to do)
511 students only: 7.14


7.4. Note that each section of the street (including each intersection) is considered to be a "resource."

To keep deadlocks from occurring, allow a vehicle to cross an intersection only if it is assured that the vehicle will not have to stop at the intersection.

7.6.

7.8. Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources, and therefore it will terminate, releasing its resources. This in turn frees sufficient resources for the other processes to complete, one at a time.

7.13.

7.14.


Chapters 22-23: 511 students only: 22.6, 23.11


22.6.

Note that the complexity of managing page faults while running kernel code is not an issue. The Linux kernel code is already able to deal with page faults (which can occur in a system call whose arguments reference user memory, which may be paged out on disk).

23.11. A process in NT is limited to 2 GB address space for data. The two-stage process allows the access of much larger datasets, by reserving space in the process's address space first, and then committing the storage to a memory-mapped file. An application can thus "window" through a large database (by changing the committed section) without exceeding process quotas or utilizing a huge amount of physical memory.