What are the four necessary conditions of deadlock prevention?
Four essential conditions for deadlock prevention are:
1. Removing the mutual exclusion condition implies that no process may have exclusive access to a resource. It proves impossible for resources which cannot be spooled, and even along with spooled resources deadlock could still happen. Algorithms which avoid mutual exclusion are termed as non-blocking synchronization algorithms.
2. The "hold and wait" conditions may be eliminated by requiring processes to request all the resources they will require before starting up. The other way is to need processes to release all their resources before requesting all the resources they will require.
3. A "no preemption" or lockout condition may also be impossible or difficult to ignore as a process has to be capable to have a resource for a specific amount of time, or the processing outcome may be inconsistent or thrashing may happen. Though, inability to enforce preemption may interfere along with a priority algorithm. Algorithms which allow preemption contain lock-free and optimistic concurrency control and wait-free algorithms.
4. The circular wait condition: Algorithms which avoid circular waits contain "disable interrupts throughout critical sections" and "use a hierarchy to find out a partial ordering of resources" and Dijkstra's solution.