Grow your YouTube views, likes and subscribers for free
Get Free YouTube Subscribers, Views and Likes

Deadlock in Operating System | 4 Conditions of Deadlocks | Deadlock Handling - Process Management

Follow
Simple Snippets

Support Simple Snippets by Donations
Google Pay UPI ID tanmaysakpal11@okicici
PayPal paypal.me/tanmaysakpal11
In this deadlock in OS video tutorial, we will understand what is a deadlock in Operating systems, what are the conditions that result in deadlocks & strategies for handling deadlocks.

Deadlocks in OS
A process in operating systems uses different resources and uses resources in following way.
1) Requests a resource
2) Use the resource
2) Releases the resource
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.

Deadlock can arise if following four conditions hold simultaneously (Necessary Conditions)
1) Mutual Exclusion: One or more than one resource are nonsharable (Only one process can use at a time)
2) Hold and Wait: A process is holding at least one resource and waiting for resources.
3) No Preemption: A resource cannot be taken from a process unless the process releases the resource.
4) Circular Wait: A set of processes are waiting for each other in circular form.

Methods for handling deadlock
There are three ways to handle deadlock
1) Deadlock prevention or avoidance The idea is to not let the system into deadlock state.
2) Deadlock detection and recovery Let deadlock occur, then do preemption to handle it once occurred.
3) Ignore the problem all together If deadlock is very rare, then let it happen and reboot the system. This is the approach that both Windows and UNIX take.

Following three strategies can be used to remove deadlock after its occurrence
1) Preemption We can take a resource from one process and give it to other. This will resolve the deadlock situation, but sometimes it does causes problems.
2) Rollback In situations where deadlock is a real possibility, the system can periodically make a record of the state of each process and when deadlock occurs, roll everything back to the last checkpoint, and restart, but allocating resources differently so that deadlock does not occur.
3) Kill one or more processes This is the simplest way, but it works.

Simple Snippets Official Website
http://simplesnippets.tech/
Simple Snippets on Facebook
  / simplesnippets  
Simple Snippets on Instagram
  / simplesnippets  
Simple Snippets on Twitter
  / simplesnippet  
Simple Snippets Google Plus Page
https://plus.google.com/+SimpleSnippets
Simple Snippets email ID
[email protected]

For More Technology News, Latest Updates and Blog articles visit our Official Website http://simplesnippets.tech/
#Deadlock #OperatingSystems #OS

posted by Taiariollm