- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Deadlock and Starvation in C#
Deadlock occurs when a resource is locked by a thread and is required by another thread at the same time. This problem occur frequenty in a multiprocessing system.
It can occur when two or more threads wait for a resource that belon to another thread. Here is an example −
|Thread One||Thread Two|
|Takes Lock P||Takes Lock Q|
|Requests Lock Q||Requests Lock P|
Thread One will not get Lock Q since it belongs to Thread Two. In the same way, Thread Two won’t get Lock P since its original owner is Thread One.
Deadlocks can also be a three-way deadlock that occurs if three threads and three locks are common. In the same way, it can occur for four-way, five-way, and other deadlocks.
Starvation is permanent blocking of one or more runnable threads in a multithreaded application.
- Starvation and Deadlock
- Difference Between Deadlock and Starvation in OS
- Deadlock Characterization
- Deadlock in Java Multithreading
- Error codes, cause and example of deadlock in DB2
- Deadlock with mutex locks
- Display all deadlock logs in MySQL?
- Investigation of root cause and resource responsible for the deadlock in DB2
- How can we avoid a deadlock in Java?
- What are the types of process scheduling algorithms and which algorithms lead to starvation?
- C++ Program for Deadlock free condition in Operating Systems
- Bitwise AND and OR in Arduino
- Logical AND and OR in Arduino
- Isupper() and Islower() and their application in C++
- INT_MAX and INT_MIN in C/C++ and Applications