Process Management (continued)
Process Termination
To eliminate deadlocks by aborting a process, we use one of two methods. In both
methods, the system reclaims all resources allocated to the terminated processes.
• Abort all deadlocked processes: This method clearly will break the
deadlock cycle, but at great expense; the deadlocked processes may have
computed for a long time, and the results of these partial computations must be
discarded and probably will have to be recomputed later.
• Abort one process at a time until the deadlock cycle is eliminated: This
method incurs considerable overhead, since, after each process is aborted, a
deadlock-detection algorithm must be invoked to determine whether any
processes are still deadlocked. Aborting a process may not be easy. If the process was
in the midst of updating a file, terminating it will leave that file in an incorrect state.
Similarly, if the process was in the midst of printing data on a printer, the system must
reset the printer to a correct state before printing the next job. If the partial termination method is
used, then we must determine which deadlocked process (or processes) should be
terminated. This determination is a policy decision, similar to CPU-scheduling decisions.