deadlock.ppt

15
Presentation on Deadlock By Ankita Goyal

Upload: ankita-goyal

Post on 03-Jan-2016

16 views

Category:

Documents


2 download

DESCRIPTION

deadlock, deadlock handling, presentation on deadlock, deadlock ppt

TRANSCRIPT

Page 1: Deadlock.ppt

Presentation on Deadlock

By Ankita Goyal

Page 2: Deadlock.ppt

Contents Introduction to deadlock Conditions for deadlock

mutual exclusion Hold and wait No preemption Circular wait

Handling deadlock Ignoring deadlock Deadlock detection Deadlock prevenntion Deadlock avoidance

Page 3: Deadlock.ppt

The Deadlock problem In a computer system deadlocks arise when

members of a group of processes which hold resources are blocked indefinitely from access to resources held by other processes within the group.

1

Page 4: Deadlock.ppt

24444

2

Page 5: Deadlock.ppt

 EXAMPLES: "It takes money to make money".

You can't get a job without experience; you can't get experience without a job. BACKGROUND:

The cause of deadlocks: Each process needing what another process has. This results from sharing resources such as memory, devices, links.

Under normal operation, a resource allocations proceed like this:: 

1. Request a resource (suspend until available if necessary ).2. Use the resource.3. Release the resource

3

Page 6: Deadlock.ppt

Conditions for deadlocks (Coffman conditions) Mutual exclusion. No resource can be shared by

more than one process at a time. Hold and wait. There must exist a process that is

holding at least one resource and is waiting to acquire additional resources that are currently being held by other processes.

4

Page 7: Deadlock.ppt

Conditions for deadlock contd.. No preemption. The operating system must

not de-allocate resources once they have been allocated; they must be released by the holding process voluntarily.

Circular wait. A process must be waiting for a resource which is being held by another process, which in turn is waiting for the first process to release the resource.

5

Page 8: Deadlock.ppt

Strategies for handling deadlocks Ignoring deadlock: It is assumed that a deadlock

will never occur application of the Ostrich algorithm used when the time intervals between

occurrences of deadlocks are large and the data loss incurred each time is tolerable

6

Page 9: Deadlock.ppt

Deadlock Detection: deadlocks are allowed to occur After a deadlock is detected, it can be

corrected by using one of the following methods: Process termination Resource preemption

7

Page 10: Deadlock.ppt

Deadlock Prevention

Deadlock prevention works by preventing one of the four Coffman conditions from occurring.

8

Page 11: Deadlock.ppt

Hold and wait condition: 1. A process acquires all the needed resources

simultaneously before it begins its execution, therefore breaking the hold and wait condition.

E.g. In the dining philosophers’ problem, each philosopher is required to pick up both forks at the same time. If he fails, he has to release the fork(s) (if any) he has acquired.

Drawback: over-cautious

9

Page 12: Deadlock.ppt

Circular wait All resources are assigned unique numbers. A process

may request a resource with a unique number I only if it is not holding a resource with a number less than or equal to I and therefore breaking the circular wait condition.

Drawback: over-cautions.

10

Page 13: Deadlock.ppt

Mutual Exclusion Practically it is impossible to provide a

method to break the mutual exclusion condition since most resources are intrinsically non-sharable, e.g., two philosophers cannot use the same fork at the same time.

11

Page 14: Deadlock.ppt

Deadlock Avoidance Deadlock can be avoided if certain

information about processes are available to the operating system before allocation of resources, such as which resources a process will consume in its lifetime

12

Page 15: Deadlock.ppt