How can the deadlock be prevented-Safe State
Safe state: A state is safe if the system is able to allocate resources to each process in some order and still avoid deadlock. Further properly a system is in safe state only if there exists a safe sequence. Safe sequence is the ways that the sequence of process in the waiting queues getting the requested resources. If it does not get the requested resources then it will have to wait. A safe state isn't deadlocked state. On the contrary a deadlock state is an unsafe state. Not all unsafe states are considered as deadlock though an unsafe state may lead to a deadlock. As long as the state is safe the operating system can avoid unsafe states. In an unsafe state, the Operating System can't prevent processes from requesting resources such that a deadlock occurs.