Operating System - Process Deadlock Condition
<<Previous - Multi Level Queue Scheduling
Next - Necessary Conditions For Deadlock >>
What is Deadlock in OS?
In multiprogramming environment, In a multiprogramming environment, a process requests resources held by a second process. If Second process requests resources held by the first process. Both Requesting process gets in a long waiting state. This blocking situation is called deadlock.
Before understanding a deadlock, Let us understand the resource types, process accesses and releases a resource
Resource types and allocation to process
Examples of resource types are: CPU cycles, files, I/O devices and Memory space. Suppose the system has two CPUs, then the resource type CPU has two instances. When a process requests an instance of the resource type, then the available instances are allocated to the requesting process.
Process - Normal Mode of operation
A process must request a resource before using it and release the resource after using it. The following is the normal mode of operation:
- Request : If the request is not granted immediately, then the process must wait until it gets that resource.
- Use : After the request is granted, the process uses it.
- Release : When the process has completed the work with that resource, then the resource must be released.
If a process A requests resources but the resources are blocked by a process B which in turn wait for resources blocked by process A, then it causes a deadlock.
<<Previous - OS Multi Level Queue Scheduling
Next - Necessary Conditions For Deadlock >>