Process Deadlock

Filter Course


Process Deadlock

Published by: Zaya

Published date: 22 Jun 2021

Process Deadlock Photo

Process Deadlock

Deadlock is a situation where several processes in the CPU compete for the finite number of resources available within the CPU. Each process holds a resource and waits to acquire a resource that is held by some other process. All the processes wait for resources in a circular fashion.

In the figure below, you can see that Process P1 has acquired resource R2 that is requested by process P2 and Process P1 is requesting resource R1 which is again held by R2.

[caption id="attachment_5698" align="aligncenter" width="614"]Deadlock Fig: Deadlock[/caption]

So process P1 and P2 form a deadlock.
Deadlock is a common problem in multiprocessing operating systems, distributed systems, and also in parallel computing systems.

Formal definition:

“A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause.”
Because all the processes are waiting, none of them will ever cause any of the events that could wake up any of the other members in the set, and all the processes continue to wait forever.

That is, none of the processes can-
• run
• release resources
• be awakened

Types of resource

1. Preempt-able resources

  • these resources can be taken away from the processes owning it with no ill effects
  • For example memory

2. Non-Preempt-able resources

  • Resources that cannot be taken away from its current owner without causing the computation to fail.
  • For example scanner, printer, etc.

In general, deadlocks involve non-preempt-able resources.