Introduction of Deadlock in Operating System. Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process.
In respect to this, how does deadlock occur in operating system?
In an operating system, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which in turn is waiting for another resource held by another waiting process.
Also Know, what are the types of deadlock?
Two types of deadlocks can be considered:
- Resource Deadlock. Occurs when processes are trying to get exclusive access to devices, files, locks, servers, or other resources.
- Communication Deadlock.
What causes deadlock?
In an operating system, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which in turn is waiting for another resource held by another waiting process.
How can we avoid deadlock in operating system?
7.4 Deadlock Prevention
- 7.4.1 Mutual Exclusion. Shared resources such as read-only files do not lead to deadlocks.
- 2 Hold and Wait. To prevent this condition processes must be prevented from holding one or more resources while simultaneously waiting for one or more others.
- 3 No Preemption.
- 4 Circular Wait.