P. 1
Operating System

Operating System

|Views: 445|Likes:
Published by api-3760571

More info:

Published by: api-3760571 on Oct 19, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





A process in a multiprogramming system is said to be in a state of deadlock (or deadlocked) if it
is waiting for a particular event that will never occur. A system is said to be deadlocked if one or more
processes are deadlocked.

Perhaps the simplest way to create the deadlocked process is this .

while (t = 1 );

Here , the process is waiting for an event (when t not equal to 1)which will never happen.
The process with the procedure revenge will execute the while loop forever and will never terminate
resulting in a deadlock.

In multi programmed operating systems, resource sharing is one of the primary goals.
When resources are shared in a population of process, each of whom maintains exclusive control over the
particular allotted resource, it is possible for deadlocks to develop. A simple example is illustrated in figure

The figure shows two processes and two resources the arrow from process to a resource
indicates the process is requesting for that particular resource but has not yet been serviced. The diagram
displays a deadlocked system. Process A holds resource 1 and needs resource 2 to continue. Process 2 holds
resource 2 and needs resource 1 to continue. Each process is waiting for the other process to release a
resource, which it will not release until the other frees its resource. The circular wait is a characteristic of
deadlocked systems.

Similarly, a related problem to deadlock is indefinite postponement. Suppose in a system
resources are allotted on priority bases. A process with a lower priority may have to wait indefinitely long
to get hold on the required resource if processes with higher priorities continue arriving. In some systems,
indefinite postponement
Is prevented by allowing a process’s priority to increase as it waits for a resource. This is known as
aging.eventually, the process’s priority will exceed all other priorities and it will be served by the system.


Following four necessary conditions must be in effect for a deadlock to exist.


processes claim exclusive control of the resources they require (mutual exclusion condition ).


Processes hold resources already allocated to them while waiting for the additional resources
(wait for condition) .


Resources cannot be removed from the processes holding them until the resources are used to
completion (no preemption condition ).


A circular chain of processes exist in which each process holds one or more resources that are
requested by the next process in the chain (circular wait condition).

Preemptible resources are such resources which can be taken away from a process by as another
process. Resources like CPU or the main memory are known as preemptible resources.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->