6.2 Explain the difference between preemptive and nonpreemptive scheduling?
Preemptive scheduling allows a process to be interrupted in the midst of its execution, taking the CPU away and allocating it to another process. Nonpreemptive scheduling ensures that a process relinquishes control
of the CPU only when it finishes with its current CPU burst.
6.6 Suppose that a scheduling algorithm (at the level of short-term CPU scheduling) favors those processes that have used the least processor time in the recent past. Why will this algorithm favor I/O-bound programs and yet not permanently starve CPU-bound programs?
It will favor the I/O-bound programs because of the relatively short CPU burst request by them; however, the CPU-bound programs will not starve because the I/O-bound programs will relinquish the CPU relatively often
to do their I/O.
6.19 Which of the following scheduling algorithms could result in starvation?
a. First-come, first-served
b. Shortest job first
c. Round robin
Shortest job first and priority-based scheduling algorithms could result in starvation.
7.11 Consider the traffic deadlock depicted in Figure 7.10
a. Show that the four necessary conditions for deadlock indeed hold in this example?
Each cross of the streets is considered as a resource, each line of cars is considered as a process.
Mutual exclusion: only one line of cars at a time can use the resource.
Hold and wait: Each line of cars is holding one resource and is waiting for the next resource.
No preemption: the resource can not be released until the whole line of cars have passed it.
Circular wait: there are 4 lines of cars l1, l2, l3, l4, l1 is waiting for l2, l2 is waiting for l3, l3 is waiting for l4, l4 is waiting for l1.
b. State a simple rule that will avoid deadlocks in this system?
There are many ways to avoid the deadlocks in this system. one way is break...