Operating System Tutorial

Operating System Practice

Drawback of Resource Preemption

In this tutorial, we will learn about the drawback of resource preemption in operating system. By Akash Kumar Last updated : May 07, 2023

To eliminate deadlocks basically using preemption, we successively preempt some resources from processes and give these resources to other processes until the deadlock cycle is broken.

If preemption is required to deal with deadlocks, then three issues related to it need to be addressed.

These issues are as follows:

1. Selecting a Victim

The basic issue is that how to select the resources and which process are to be preempted, we must determine the order of preemption to minimize cost. Basically, the cost factor may include some parameters such as a number of resources a deadlocked process is holding and the amount of time the process has thus far consumed during its execution.

2. Rollback

If we preempt a resource from the process, what should be done with that process is the biggest question and the only answer we get is to roll back the process and goto some safe state and restart it from that start.

Basically, in general, it is very hard to determine the safe state and hence it is better to rollback completely abort the process and then restart it again. Although it is more effective to roll back the process only as far as to break the deadlock. This method basically requires the system to keep more information about the state of all running process.

3. Starvation

How do we ensure that starvation will not occur? That is, how can we guarantee that resource will not always be preempted from the same process?

In a system where victim selection is basically based on the cost factor. It may happen that the same process is always picked as a victim. As a result, process will never complete its designated task and which may lead to starvation.

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.