If each process in the set is waiting for an event that only another process in the set can cause is called Deadlock.
Suppose process A holds resource C and process B holds resource D.
Now process A request for resource D and process B request for resource C but none of the process will get this resources as both the resources are already busy with some other process hence neither of them can proceed further. This situation is called Deadlock.
There are 4 conditions which leads to Deadlock. They are as follow
- Mutual exclusion condition
- Hold and wait condition
- No preemption condition
- Circular wait condition
All the above four condition should be present for deadlock to occur.
Deadlock Ignorance :
Stick your head in the sand and pretend there is no problem at all, this method of solving any problem is called Ostrich Algorithm. The method of solving any problem varies according to the people.
Scientist all over the world believe that the most efficient method to deal with deadlock is deadlock prevention. But the Engineers that deal with the system believe that deadlock prevention should be paid less attention as there are very less chances for deadlock occurrence.
System failure, compiler error, programming bugs, hardware crashes that occur once a week should be paid more attention rather than deadlock problem that occur once in years.Therefore most of the engineers don’t pay much amount in eliminating the deadlock.
Many operating system suffer from deadlock that are not even detected and than automatically broke. Just as an explanation we know that the number of process is determined by the process table. Now as we know there are only finite number of slots in the process table and hence when the table is full the fork fails. Now the reasonable approach for the new fork has to wait and try again when the slot in the process table is empty.
Also such problem is notices while opening and closing file. The maximum time the file is opened is restricted and mention in the i-node table and thus similar problem is observed when the table is filled. Another limited resource is mentioned as swap space. In fact, all the table storing data in the operating system has finite resource limit. It might happen that a collection of n processes might each claim 1/n of the total, Should we clear all of these and then each try to claim another one?
Including UNIX and WINDOWS, all the operating system ignore the deadlock first assuming that the user is restricted to one process. The deadlock ignorance comes into picture frequently because by this method deadlock is eliminated for free rather than spending much on other deadlock prevention methods also putting some inconvenient restriction on process. Thus we have to decide between the correctness and convenience between the different methods of solving the deadlock.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Recovery from Deadlock in Operating System
- Introduction of Deadlock in Operating System
- Conditions for Deadlock in Operating System
- Deadlock Detection Algorithm in Operating System
- Program for Deadlock free condition in Operating System
- Hierarchical Deadlock Detection in Distributed System
- Difference between Deadlock Prevention and Deadlock Avoidance
- System Protection in Operating System
- Multithreading in Operating System
- Segmentation in Operating System
- Paging in Operating System
- Thread in Operating System
- Introduction of Operating System - Set 1
- Functions of Operating System
- Inode in Operating System
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.