CS 241 Review
Deadlock
In order for deadlock to occur, Coffman Conditions must present.
Why need to know Coffman Condition? Deadlock occurs only if all of the following conditons are exist. It looks like these four conditions are difficult to happen at the same time, but it is very likely to be happen.
- Mutal Exclusion : The resource can only be access to one process at a time.
- Hold and Wait : A process is requesting a resource while holding a resource.
- Circular Wait : Process A holding resource X and Process B holding resourcec Y. Meanwhile, Process A requests resouces Y and Process B requests resource X. The meaning is very straight forward, just like the name making circular loop.
- No Preemption : A process can not force another process to release its resources.
Prevent Deadlock
The ways to prevent deadlock happen is simple, breaking one of the Coffman Conditions.