Deadlock In Operating System

Deadlock, the name says it all, there is a lock of Death, that can also be inferred as no Progress.

This is a very simple yet most confused topic of Operating System, as the numericals that are asked from this topic are considered as difficult but I don't understand why. Basically, 

Deadlock is a situation where a process depends on other process(for some resource) that in turn depends on some other process that is not going to free the required resource so in turn the whole circle of processes is stuck and there is a Deadlock, It's like a government process although in this just a Reboot can clear the problems. 

There is a very similar term that goes with this Deadlock and confuses many, and that is Livelock, the only difference is in the state of Processes in both the Locks, in Deadlock the Processes are in a passive state but in Livelock the Processes are in active state, Livelock is mostly understood as situation where 2 people block each other's paths in a narrow corridor, and they both try to go in the same direction in order to go ahead and thus every time they both cannot make any progress but they are moving(that refers to the Active State).

The main things to keep in mind for Deadlock is the reasons for it, which includes 4 things:-

1) Mutual Exclusion

2) No Pre-emption

3) Hold and Wait

4) Circular Wait

If we remove all of the above mentioned reasons then the Deadlock won't occur but usually it does, like Thanos it is also Inevitable.

Now after Deadlock has occured what to do? 

So we have 3 methods for that, Deadlock Ignorance Method( Ostrich Method, literally ignores the Deadlock, my favourite ;) ), Deadlock Prevention Method, Deadlock Detection and Recovery Method and lastly the Banker's Algorithm(Deadlock Avoidance Method).

Mostly we will be giving importance to the Banker's Algorithm for Deadlock Avoidance and will be working on RAGs, that is Resource Allocation Graphs and will be guessing through these Graphs if there will be a Deadlock or not.

I am gonna work on some Problem Statements now, it's around 11:45, and then I will be doing something for the Networking Code that I had posted yesterday and will try to make it better and fix some issues, and then maybe  I am gonna hit the hay... Cya!

Comments

Popular Posts