You are on page 1of 2

6. Consider the directed resource graph shown above and answer the following questions: a. Is the system deadlocked?

No, the system is not deadlocked. b. Are there any blocked processes? No. If process P1 is next given requested resource R2, P1 ill complete, allo ing P2 to also complete. c. hat is the resulting graph after reduction by !"?

d. what is the resulting graph after reduction !#?

e. $oth !" and !# have requested %#: ". hat is the status of the system if !#&s request is granted before !"&s? !he system ould "e deadlocked# P1 ould "e una"le to complete $ aiting for resource R2%, and P2 ould "e una"le to complete $ aiting for resource R1%. #. hat is the status of the system if !"&s request is granted before !#&s? !he system ould not "e deadlocked, and "oth processes ould run to completion. Resource R2 ould "e allocated to P1, allo ing that process to complete first, making the resources R1 and R2 availa"le for P2 to complete. "'. (iven the four primary types of resources ) C!*+ memory+ storage devices+ and files ) select for each one the most suitable technique for fighting deadlock and briefly e,plain why it is your

choice. a% &P' (llo preemptive interruption of processes, using a round)ro"in algorithm to allocate &P' resources to each process* possi"ly support varia"le priority levels to give larger &P' quantums to higher)priority processes. !his approach fights deadlock "y eliminating the possi"ility of the mutual exclusion condition and the no)preemption condition. "% +emory 'se a virtual memory scheme to allo preemptive use of main memory# s ap memory to disk storage at preemptive s itching, and restore it later hen the process resumes and requires it. c% ,torage devices If all process resource requirements can "e kno n in advance, use the -anker.s (lgorithm to safely schedule resources to avoid deadlock due to the circular ait condition. If this is not possi"le, enforce time limits on storage device locks to prevent persistent circular aits. d% /iles +inimi0e file resource contention $the mutual exclusion deadlock condition% "y using in) memory "uffers of file contents that are "eing changed "y a process that has an exclusive rite lock, allo ing read)only use of the file "y other processes. (s the exclusive lock is released, rite the updated contents to the file.

You might also like