Deadlock n starvation r they same??????

Deadlock

 A deadlock occurs when two (or more) threads have created a situation where they are all blocking each other. Imagine that threads T1 and T2 need to acquire both resources A and B in order to do their work. If T1 acquires resource A, then T2 acquires resource B, T1 could then be waiting for resource B while T2 was waiting for resource A. In this case, both threads will wait indefinitely for the resource held by the other thread. These threads are said to be deadlocked.

Starvation occurs when a scheduler process (i.e. the operating system) refuses to give a particular thread any quantity of a particular resource (generally CPU). If there are too many high-priority threads, a lower priority thread may be starved. This can have negative impacts, though, particularly when the lower-priority thread has a lock on some resource.



Starvation
Deadlock
Starvation happens if same transaction is always choosen as victim.
A deadlock is a condition in which two or more transaction are waiting for each other.
It occurs if the waiting scheme for locked items in unfair, giving priority to some transactions over others.
A situation where two or more transactions are unable to proceed because each is waiting for one of the other to do something.
Starvation is also known as lived lock.
Deadlock is also known as circular waiting.
Avoidance:
->switch priorities so that every thread has a chance to have high priority.
-> Use FIFO order among competing request.
Avoidance:
->Acquire locks are predefined order.
->Acquire locks at once before starting.
It means that transaction goes in a state where transaction never progress.
It is a situation where transactions are waiting for each other.
SHARE

About df

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment