CS 354 Mini Practice Mid-term Exam (Spring 1999) I True or false [about 20%] For each __ response below, write T if it is true, and F if it is false. 1. The SJF CPU scheduling algorithm __ a. favors IO bound jobs to compute bound jobs __ b. is difficult to implement in practice __ c. always gives better turnaround time than FCFS __ d. can lead to process starvation II Quickies [about 20%] Give a one or two sentence answer to each of the following. 1. Can one process be involved in a deadlock with itself? Explain. III Standard problems [about 35%] 1. Consider a system with 10, 5 and 7 instances of three resources, respectively, and the following resource allocation state: Process Allocation Max P 0 1 0 7 5 3 Q 3 0 2 3 2 2 R 3 0 2 9 0 2 S 2 1 1 2 2 2 T 0 0 2 4 3 3 a. Determine whether the above state is safe or not. b. Assume that a request (0,2,0) arrives for P. Can the request be granted if deadlocks are to be avoided? Show how you arrive at your decision. c. Sketch the relationship between safe, unsafe and deadlock states. IV Harder problems [about 25%] 1. Consider static priority CPU scheduling, same as the one described in question 3 of homework 2. Assume now a system with three processes (that may become runnable at different times). A low priority process P synchronizes with a high priority process Q using a binary semaphore. In addition, there is a third mid-priority process R that is long running and CPU intensive, but that does not synchronize with either P or Q. a. Describe how static priority in this case can adversely affect the goal of letting a higher priority process finish as soon as possible, ahead of a lower priority one if possible. b. Assuming that the system always knows the ownership of a binary semaphore, devise a solution to the above problem. (Hint: allow priorities to be changed.)