Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between deadlock and indefinite postponement?

Tags:

concurrency

Deadlock - a situation in which two or more competing actions are each waiting for the other to finish, and thus neither ever does.

Indefinite Postponement - to delay indefinitely the scheduling of a process while other processes receive the system's attention

These 2 terms seem very similar. How can I tell them apart?

like image 873
drum Avatar asked Feb 15 '23 22:02

drum


2 Answers

In any system that keeps processes waiting while it makes resource-allocation and process scheduling decisions, it is possible to delay indefinitely the scheduling of a process while other processes receive the system's attention. This situation, variously called indefinite postponement, indefinite blocking, or starvation, can be as devastating as deadlock

From:

http://wps.prenhall.com/esm_deitel_os_3/17/4402/1127072.cw/index.html

Havender’s conditions for deadlock(1968) - 7.2.1

• There is a circular list of processes each wanting a resource owned by another in the list.

• Resources cannot be shared.

• Only the owner can release the resource

• A process can hold a resource while requesting another

From:

http://www.cs.auckland.ac.nz/~robert-s/415.340/lectures_1997/lecture35.pdf

So indefinite postponement causes 1 process to suffer while others continue normally, which can be caused by poor scheduling or other reasons, a situation where the indefinitely postponed process always has a lower priority than all other processes after the same resource. At some later time, it MAY end up with high enough priority to get the resource.

Deadlock results when a process is requesting a resource held by another process. That process (A) will not release the resource until it gets its hands on another resource it is requesting, which incidentally is held by another process (B) which will not release it until it recieves a resource held by another process (C) which will not release it until it gets that resource being held onto by (A). That scenario involved 3 processes, A,B,C; but it could potentially involve any "circle" of 2 or more processes.

like image 88
chiliNUT Avatar answered May 27 '23 05:05

chiliNUT


If two processes are in deadlock, it is not possible for them to ever do any useful work - because they depend on one another, and neither will ever yield.

If process is postponed indefinitely, it is at least theoretically possible for such process to continue and do some useful work at some time in the future. It could happen if other processes stop abusing resources or simply quit, or if you increase priority of process being indefinitely postponed.

like image 39
mvp Avatar answered May 27 '23 05:05

mvp