Starting from:

$29

CS 372 Homework 4

CS372 Operating System

HW4

 

.      7.12  Assume a multithreaded application uses only reader — writer locks for synchronization. Applying the four necessary conditions for deadlock, is deadlock still possible if multiple reader—writer locks are used? 


.      7.19  Consider the version of the dining-philosophers problem in which the chopsticks are placed at the center of the table and any two of them can be used by a philosopher. Assume that requests for chopsticks are made one at a time. Describe a simple rule for determining whether a particular request can be satisfied without causing deadlock given the current allocation of chopsticks to philosophers. 


7.22 Consider the following snapshot of a system:



Using the banker’s algorithm, determine whether or not each of the following states is unsafe. If the state is safe, illustrate the order in which the processes may complete. Otherwise, illustrate why the state is unsafe.

a)    Available = (0, 3, 0, 1) 


b)   Available = (1, 0, 0, 2) 


.      7.23  Consider the following snapshot of a system:


.     

.       
Answer the following questions using the banker’s algorithm:

a)    Illustrate that the system is in a safe state by demonstrating an order in which the processes may complete. 


b)   If a request from process P1 arrives for (1, 1, 0, 0), can the request be granted immediately? 


c)    If a request from process P4 arrives for (0, 0, 2, 0), can the request be granted immediately? 


More products