Tutorial Deadlock Answer

July 15, 2017 | Author: nornajwanajib4965 | Category: Overdraft, Cheque, Areas Of Computer Science, Technology, Computing
Share Embed Donate


Short Description

Download Tutorial Deadlock Answer...

Description

TUTORIAL CHAPTER 7: DEADLOCK QUESTION 1 Give at least two “real life” examples (not related to a computer system environment) of each of these concepts: deadlock, starvation, and race. Describe how the deadlocks can be resolved. A response that shows originality and thoughtfulness is acceptable. Deadlock: consider a savings and loan institution where more savers want to withdraw money from their accounts than the institution has available. The institution cannot force the borrowers to return the money they borrowed. This is a deadlock where the borrowers hold the resource (money) that the institution needs to satisfy the request of the savers. A remote control toy car that only goes forward gets stuck against a wall. Starvation: consider a very timid customer waiting to be served at a crowded counter where no service policy has been set up. The more aggressive customers capture the attention of the server and postpone service to the timid customer. Holding the door for a long stream of people. You hold the door to be nice and move out of the way, but eventually people just keep walking through the door and you are stuck holding it for everyone and never get to pass through the door. Race: consider the case where you write a check knowing that you will be overdrawn if your paycheck does not get deposited (and cleared) before the check you just wrote is cashed. QUESTION 4 Describe the fate of the “victim” in deadlock resolution. Describe the actions required to complete the victim’s tasks? Unfortunately, the victim is not allowed to complete its execution. It’s progress is halted and its resources are released. Ideally, an error message is returned to the user so the job can be started again. Because the victim’s progress is stopped, the only way to complete the tasks is to start it again, unless the operating system has a mechanism to save the job’s progress, as is, and pick it up from there when the resources become available (but this is not something we have covered in this chapter). QUESTION 6 Consider the directed resource graph shown in Figure 2, and answer the following questions. a. Identify all of the deadlocked processes. P3 and P4. b. Can the directed graph be reduced, partially or totally? Yes, it can be reduced partially if the R2 resources are allocated to P1 and P2. c. Can the deadlock be resolved without selecting a victim? No. Either P3 or P4 would have to be terminated to allow the other remaining process to complete its execution. d. Which requests by the three processes for resources from R2 would you satisfy to minimize the number of processes involved in the deadlock? We suggest that they satisfy requests by P1 and P2 so they could finish. At this point, only P3 and P4 are involved in deadlock.

e. Conversely, which requests by the three processes for resources from R2 would you satisfy to maximize the number of processes involved in deadlock? We suggest that they satisfy the request by P3 and either P1 or P2, then P3, P4 and either P1 or P2 would be involved in deadlock (although either P1 or P2 would only be temporarily blocked). QUESTION 7 Consider an archival system with 13 dedicated drives. All jobs currently running on this system require a maximum of 5 drives to complete but they each run for long periods of time with just 4 drives and request the fifth one only at the very end of the run. Assume that the job stream is endless. a 1. Two jobs, each being allocated 5 tape drives, the maximum requested by each to complete execution. a 2. The minimum number of idle tape drives is 3. The maximum number of idle tape drives is 5. Explanation: If two jobs are in the system and each is in the completion stage, then the 3 tape drives that were not allocated are idle, as they were from the beginning. If the two jobs are at the stage of using the 4 tape drives, then the extra 2 allocated drives plus the 3 never allocated are idle. Of course all 13 drives could be idle if there were no jobs in the system. b1. Three jobs, each being allocated 4 tape drives with the extra in reserve to allocate to the job nearing completion. b2. The minimum number of idle tape drives is 0. The maximum number of idle tape drives is 1. Explanation: If one of the three jobs in the system is nearing completion, then it is using 5 drives while the other two are using 4 drives each, therefore all drives are busy. If none of the jobs in the system is nearing completion, then the tape held in reserve is the only one idle. Of course all 15 drives could be idle if there were no jobs in the system.

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF