In the context of operating systems and resource management, resources are categorized into two types based on whether they can be taken away from a process without causing issues: preemptable and non-preemptable resources. These classifications affect how deadlocks can be handled and how resources are managed within the system.
1.) Preemptable Resources
Preemptable resources are resources that can be taken away from a process temporarily and assigned to another process without any adverse effects or data loss.
- The original process can resume its work once the resource is returned, and the system can easily reallocate preemptable resources to balance workload or avoid delays.
• Preemptable resources simplify deadlock handling since they can be reallocated or taken back from processes involved in deadlock situations, breaking the deadlock cycle.
2.) Non-Preemptable Resources
Non-preemptable resources are resources that cannot be taken away from a process once it has been allocated.
- Releasing a non-preemptable resource prematurely could lead to data inconsistency, errors, or loss of information, so the process must release the resource voluntarily after it has finished using it.
Examples:
- Once a print job has started, the printer cannot be preempted. Taking it away from the current process would cause incomplete or corrupted output.
- If a process is writing data to a disk, interrupting it could lead to data corruption, so it must complete its operation before the resource can be reassigned.