
NO. 1


Recovery:
Once a deadlock has been detected it must be untangled and system returned to normal as quickly as possible.
There are several recovery algorithms, all requiring at least one victim, an expendable job, which, when removed from deadlock, frees system.
1. Terminate every job that’s active in system and restart them from beginning.
2. Terminate only the jobs involved in deadlock and ask their users to resubmit them.
3. Terminate jobs involved in deadlock one at a time, checking to see if deadlock is eliminated after each removal, until it has been resolved.
4. Have job keep record (snapshot) of its progress so it can be interrupted and then continued without starting again from the beginning of its execution.
5. Select a non-deadlocked job, preempt resources it’s holding, and allocate them to a deadlocked process so it can resume execution, thus breaking the deadlock
6. Stop new jobs from entering system, which allows non-deadlocked jobs to run to completion so they’ll release their resources (no victim).
Avoiding Deadlocks:
•Even if OS can’t remove 1 conditions for deadlock, it can avoid one if system knows ahead of time sequence of requests associated with each of the active processes.
•Dijkstra’s Bankers Algorithm (1965) used to regulate resources allocation to avoid deadlock.
•Safe state -- if there exists a safe sequence of all processes where they can all get the resources needed.
•Unsafe state -- doesn’t necessarily lead to deadlock, but it does indicate that system is an excellent candidate for one.
Prevention of Deadlock:
•To prevent a deadlock OS must eliminate 1 out of 4 necessary conditions.
–Same condition can’t be eliminated from every resource.
•Mutual exclusion is necessary in any computer system because some resources (memory, CPU, dedicated devices) must be exclusively allocated to 1 user at a time.
–Might be able to use spooling for some devices.
–May trade 1 type of deadlock (Case 3) for another (Case 5).
Detection:
•Use directed graphs to show circular wait which indicates a deadlock.
•Algorithm used to detect circularity can be executed whenever it is appropriate
4. Assuming you had sufficient funds to upgrade only one component for a system with which you are familiar, explain which component you would choose to upgrade to improve overall performance, and why?
Every components has its own functions in improving the performance of the computer. Upgarding CPU is one way of improving the over-all performance of the omputer because the computer CPU is responsible for handling all instructions and calculation it receives from other hardware components in the computer and software programs running on the computer.