Operating System - Deadlocks
What is Deadlock?
In multiprogramming environment, A process requests resources but the resources are not available at that time because those resources are held by the other waiting process. So the requesting process is in a waiting state. This blocking situation is called deadlock.
Resource types and allocation to process
The example of resources types are: CPU cycles, files, I/O devices and Memory space. Suppose, if the system has two CPUs, then the resource type CPU has two instances. When a process requests an instance of resource type, then the available instances are allocated to the requesting process.
Process - Mode of operation
The 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 their work with that resource, then that resource must be released.