Opearating System (OS) BCA Question Answers Sheet Part 3

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Q-1. What methods are used for handling deadlock?

A-1. There are mainly four methods for handling deadlock.

1. Deadlock ignorance- It is the most popular method and it acts as if no deadlock and the user will
restart. As handling deadlock is expensive to be called off a lot of codes need to be altered which will -
decrease the performance so for less critical jobs deadlock are ignored. Ostrich algorithm is used in
deadlock Ignorance. Used in windows, Linux etc.

2. Deadlock prevention- It means that we design such a system where there is no chance of having a
deadlock.

3. Deadlock avoidance- Here whenever a process enters into the system it must declare maximum
demand. To the deadlock problem before the deadlock occurs. This approach employs an algorithm to
access the possibility that deadlock would occur and not act accordingly. If the necessary condition of
deadlock is in place it is still possible to avoid feedback by allocating resources carefully.

Q-2. Explain the 4 conditions of deadlock handling.

A-2. (a) Mutual exclusion: It can’t be resolved as it is the hardware property. For example, the printer
cannot be simultaneously shared by several processes. This is very difficult because some resources are
not sharable.

(b) Hold and wait: Hold and wait can be resolved using the conservative approach where a process can
start it and only if it has acquired all the resources.

(c) Active approach: Here the process acquires only requires resources but whenever a new resource
requires it must first release all the resources.

(d) Circular wait: In order to remove circular wait, we assign a number to every resource and the process
can request only in the increasing order otherwise the process must release all the high number
acquires resources and then make a fresh request.
Q-3. Why is prevention not a practical solution to deadlocks?

A-3. Delays process initiation

Processes must know future resource need

Pre-empts more often than necessary

Dis-allows incremental resource requests

Inherent preemption losses.

Q-4. What is the difference between deadlock prevention and deadlock avoidance?

A-4.
Q-5. What are three methods of recovery from deadlock? Explain.

A-5.
Deadlock Recovery through Preemption- The ability to take a resource away from a process, have
another process use it, and then give it back without the process noticing. It is highly dependent on the
nature of the resource. Deadlock recovery through preemption is too difficult or sometime impossible.

Deadlock Recovery through RollBack- In this case of deadlock recovery through rollback, whenever a
deadlock is detected, it is easy to see which resources are needed.To do the recovery of deadlock, a
process that owns a needed resource is rolled back to a point in time before it acquired some other
resource just by starting one of its earlier checkpoints.

Deadlock Recovery through Killing Processes- This method of deadlock recovery through killing
processes is the simplest way of deadlock recovery.Sometime it is best to kill a process that can be
return from the beginning with no ill effects.

You might also like