CS400 Operating Systems Homework #6 Due before next class. Turn in your HW on SCANTRON answer sheet to your graders. Turn in your HW on Santron answer sheet to your graders. ================================================ Student ID: Name: ================================================ 1. A deadlocked state occurs whenever ____. a) a process is waiting for I/O to a device that does not exist b) the system has no available free resources c) every process in a set is waiting for an event that can only be caused by another process in the set d) a process is unable to release its request for a resource after use 2. One necessary condition for deadlock is ____, which states that at least one resource must be held in a non-sharable mode. a) hold and wait b) mutual exclusion c) circular wait d) no preemption 3. One necessary condition for deadlock is ______, which states that a process must be holding one resource and waiting to acquire additional resources. a) hold and wait b) mutual exclusion c) circular wait d) no preemption 4. One necessary condition for deadlock is ______, which states that a resource can be released only voluntarily by the process holding the resource. a) hold and wait b) mutual exclusion c) circular wait d) no preemption 5. One necessary condition for deadlock is ______, which states that there is a chain of waiting processes whereby P0 is waiting for a resource held by P1, P1 is waiting for a resource held by P2, and Pn is waiting for a resource held by P0. 1 a) hold and wait b) mutual exclusion c) circular wait d) no preemption 6. Deadlock prevention and deadlock avoidance are essentially the same approaches for handling deadlock. a) True b) False 7. In a system resource-allocation graph, a directed edge from a process to a resource is called ____. a) an assignment edge b) a claim edge c) a request edge d)None of the above 8. A cycle in a resource-allocation graph is ____. a) a necessary and sufficient condition for deadlock in the case that each resource has more than one instance b) a necessary and sufficient condition for a deadlock in the case that each resource has exactly one instance c) a sufficient condition for a deadlock in the case that each resource has more than once instance d) neither necessary nor sufficient for indicating deadlock in the case that each resource has exactly one instance 9. To handle deadlocks, operating systems most often _____. a) pretend that deadlocks never occur b)use protocols to prevent or avoid deadlocks c) detect and recover from deadlocks d)None of the above 10. Which of the following statements is true? a) A safe state is a deadlocked state. b) A safe state may lead to a deadlocked state. c) An unsafe state is necessarily, and by definition, always a deadlocked state. d) An unsafe state may lead to a deadlocked state. 11. Suppose that there are ten resources available to three processes. At time 0, the following data is collected. The table indicates the process, the maximum number of resources needed by the process, and the number of resources currently owned by each process. Which of the following correctly characterizes this state? Process Maximum Needs Currently Owned P0 10 4 2 P1 3 1 P2 6 4 a) It is safe. b) It is not safe. c) The state cannot be determined. d) It is an impossible state. 12. Suppose that there are 12 resources available to three processes. At time 0, the following data is collected. The table indicates the process, the maximum number of resources needed by the process, and the number of resources currently owned by each process. Which of the following correctly characterizes this state? Process Maximum Needs Currently Owned P0 10 4 P1 3 2 P2 7 4 a) It is safe. b) It is not safe. c) The state cannot be determined. d) It is an impossible state. 13. Which of the following data structures in the banker's algorithm is a vector of length m, where m is the number of resource types? a) Need b) Allocation c) Max d) Available 14. Assume there are three resources, R1, R2, and R3, that are each assigned unique integer values 15, 10, and 25, respectively. What is a resource ordering which prevents a circular wait? a) R1, R2, R3 b) R3, R2, R1 c) R3, R1, R2 d) R2, R1, R3 15. Deadlock ___________________ is a set of methods for ensuring that at least one of the necessary conditions for deadlock cannot hold. a) prevention b) avoidance c) detection and recovery 16. Deadlock ____________ requires that the operating system be given, in advance, additional information concerning which resources a process will request and use during its lifetime. a) prevention b) avoidance 3 c) detection and recovery 17. Which of the following is not the solution to ensure that the hold-and-wait condition never occurs in a system. a) impose a total ordering of all resource types, and to require that each process requests resources in an increasing order of enumeration. b) One protocol requires each process to request and be allocated all its resources before it begins execution. c) An protocol allows a process to request resources only when it has none. d) Before a process can request any additional resources, it must release all the resources that it is currently allocated. 18. What is one way to ensure that a circular-wait condition does not occur? a) Impose a total ordering of all resource types, and to require that each process requests resources in an increasing order of enumeration. b) One protocol requires each process to request and be allocated all its resources before it begins execution. c) A protocol allows a process to request resources only when it has none. d) Before a process can request any additional resources, however, it must release all the resources that it is currently allocated. 19. A(n) ___ edge indicates that a process may request a resource at some time in the future. It is represented in the resource-allocation graph by a dashed line. a) claim b) Request c) Assignment d) Allocation 20. There are two methods for eliminating processes by aborting a process. The first method is to abort all deadlocked processes. The second method is to abort one process at a time until the deadlock cycle is eliminated. Which method will need to run deadlock-detection algorithm? a) The first method. b) The second method. 21. There are two methods for eliminating processes by aborting a process. The first method is to abort all deadlocked processes. The second method is to abort one process at a time until the deadlock cycle is eliminated. The ____ method could terminate more processes than necessary processes to remove the deadlock, while the __________ could run slower to fix the deadlock problem since a deadlock detection is run after each process is removed. a) 1st, 2nd. b) 2nd, 1st 4 22. A safe state ensures that there is a sequence of processes to finish their program execution. Deadlock is not possible while the system is in a safe state. One technique for avoiding deadlock is to ensure that the system always stays in a safe state. a) True b) False 23. If a system goes from a safe state to an unsafe state, deadlock is possible. a) True b)False 24. The circular-wait condition for a deadlock implies the hold-and-wait condition. A) True B) False 25. If a resource-allocation graph has a cycle, the system must be in a deadlocked state. A) True B) False 26. Protocols to prevent hold-and-wait conditions typically also prevent starvation. A) True B) False 27. The wait-for graph scheme is not applicable to a resource allocation system with multiple instances of each resource type. A) True B) False 28. The banker's algorithm is useful in a system with multiple instances of each resource type which wait-for graph scheme is not applicable to. A) True B) False 29. Ordering resources and requiring the resources to be acquired in order prevents the circular wait from occurring and therefore prevents deadlock from occurring. A) True B) False 30. A system in an unsafe state will ultimately deadlock. A) True B) False 31. Deadlock prevention and deadlock avoidance are essentially the same approaches for handling deadlock. 5 a) True b) False 32. Given a priori information about the ________ number of resources of each type that maybe requested for each process, it is possible to construct an algorithm that ensures that the system will never enter a deadlock state. a) minimum b)average c) maximum d)approximate 33. A deadlock avoidance algorithm dynamically examines the __________, to ensure that a circular wait condition can never exist. a) resource allocation state b)system storage state c) operating system d)resources 34. A state is safe if _______. a) the system does not crash due to deadlock occurrence b)the system can allocate resources to each process in some order and still avoid a deadlock c) the state keeps the system protected and safe d)All of these 35. A system is in a safe state only if there exists a _______. a) safe allocation b) safe resource c) safe sequence d) All of these 36. A system has 12 magnetic tape drives and 3 processes : P0, P1, and P2. Process Maximum needs allocated P0 10 5 P1 4 2 P2 9 2 37. What are the current available resources? a) 3 b)4 c) 5 d)6 38. (Continue the above question.) Which of the following sequence is a safe sequence? a) P0, P1, P2 6 b)P1, P2, P0 c) P2, P0, P1 d)P1, P0, P2 39. The resource allocation graph is not applicable to a resource allocation system _____. a) with multiple instances of each resource type b)with a single instance of each resource type c) Both a and b 40. The Banker's algorithm is _____________ than the resource allocation graph algorithm. a) less efficient b)more efficient c) None of these 41. The data structures available in the Banker's algorithm does not include a) Available b)Need c) Allocation d)Maximum e) Minimum 42. A system with 5 processes P0 through P4 and three resource types A, B and C. At time t0, the following snapshot has been taken: Total number of resources A B C 10 5 7 Allocation (process-wise: P0 through P4 top to bottom) A B C P0 0 1 0 P1 2 0 0 P2 3 0 2 P3 2 1 1 P4 0 0 2 Max (process-wise: P0 through P4 top to bottom) A B C P0 7 5 3 P1 3 2 2 P2 9 0 2 P3 2 2 2 P4 4 3 3 7 43. What are the available resources per each type? Available resources A B C a) 3 3 2 b) 2 3 2 c) 3 3 3 d) 2 2 3 e) 3 3 4 44. (Continue) The sequence leads the system to : a) an unsafe state b)a safe state c) a protected state d)a deadlock 45. Each request requires that the system consider the __________, _____________, ____________ to decide whether the current request can be satisfied or must wait to avoid a future possible deadlock. (choose three) a) resources currently available b) processes that have previously been in the system c) resources currently allocated to each process d) future requests and releases of each process 46. A computer system has 6 tape drives, with 'n' processes competing for them. Each process may need 3 tape drives. The maximum value of 'n' for which the system is guaranteed to be deadlock free is _______. a) 2 b)3 c) 4 d)1 47. Which of the following is not a disadvantage of the banker’s algorithm: a) The numbers of processes and resources have to be fixed. b)All processes must know and state their maximum resource need in advance. c) All processes must terminate and release all its resouces in a finite amount of time. d)The system can be less productive than the deadlock prevention method. 8
© Copyright 2024 Paperzz