CSE 435- Final Exam Prep

CSE 435- Final Exam Prep - W13 P1 Give examples of reusable...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
W13 P1 Give examples of reusable and consumable resources. Examples of resuable resources are processors, I/O channels, main and secondary memory, devices, and data structures such as files, databases, and semaphores. Examples of consumable resources are interrupts, signals, messages, and information in I/O buffers. W13 P2 (a) What are the three conditions that most be present for deadlock to be possible? Mutual exclusion - Only one process may use a resource at a time. Hold and wait - A process may hold allocated resources while awaiting assignment of others. No preemption - No resource can be forcibly removed from a process holding it. (b) What are the four conditions that create deadlock? The above three conditions, plus: Circular wait - A closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain. W13 P3 How can the hold-and-wait condition be prevented? The hold-and-wait condition can be prevented by requiring that a process request all of its required resources at one time, and blocking the process until all requests can be granted simultaneously. W13 P9 List two ways in which the no-preemption condition can be prevented? First, if a process holding certain resources is denied a further request, that process must release its original resources an, if necessary, request process requests a resource that is currently held by another process, them again together with the additional resource. Alternatively, if a the operating system may preempt the second process and require it to release its resources. W13 P5 How can the circular wait condition be prevented? The cimulanwait condition can be prevented by defining a linear ordering of resource types. If a process has been allocated resources of type R, then it may subsequently request only those resources of types following R in the ordering. W14 P2 Available = [2 1 0 0] 2 0 0 11 Request = [1 0 1 0 9 1 0 0 0 0 1 01 Allation = [2 0 0 1 oc o 1 2 0 Deadlock Detection Algorithm: a. Mark each process that has a row in the Allocation matrix of all are. . b. Initialize a temproary vector W to equal the Available ector. c. Find an index i such that process i is currently un- marked and eth row of Q is less than or equar to W. That is, Qiic < Wk, for 1 < k •<, rn. if no such row is found terminate the algorithm. d. If such a row is found, mark process i and add the corresponding row of the allocation matrix to W. That is, set VW, = Wk Ai k, for 1 < k < rn. Return to step c. = [2 1 0 0] Third row, 2100 + 0120 = 2220 v ' -First rove 2220 -I- 0010 = 2230 Setord row: 2230 -I- 2001 = 4231 No Deadlock W14 Consider a system with a tohtal of 150 units of memory, allocated to three processes as shown: Process Max Hold 1 70 4 4: Apply the Banker's Algorithm 2 60 3 60 15 to determine whether it would be safe to grant each of the following requests. If yes, indicate a sequence of termina- tions that could be guaranteed possible. If no, show the reduction of the resulting allocation table.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online