JaroslavTulach at 05:33, 10 October 2023 - 2023-10-10 05:33:37

←Older revision Revision as of 05:33, 10 October 2023
Line 1: Line 1:
-
Fighting problems with [[ImpossibleThreading|threading may seem impossible]], but there is an easy way avoid [[deadlock]]s. Just make sure **one** (enough if only one) of following conditions isn't true. Then a [[deadlock]] cannot occur.
+
Fighting problems with [[ImpossibleThreading|threading may seem impossible]], but there is an easy way avoid [[deadlock]]s. Just make sure '''one''' (enough if only one) of following conditions isn't true. Then a [[deadlock]] cannot occur.
== Mutual exclusion ==
== Mutual exclusion ==

JaroslavTulach at 05:33, 10 October 2023 - 2023-10-10 05:33:17

←Older revision Revision as of 05:33, 10 October 2023
Line 1: Line 1:
 +
Fighting problems with [[ImpossibleThreading|threading may seem impossible]], but there is an easy way avoid [[deadlock]]s. Just make sure **one** (enough if only one) of following conditions isn't true. Then a [[deadlock]] cannot occur.
 +
== Mutual exclusion ==
== Mutual exclusion ==

JaroslavTulach at 08:45, 1 August 2018 - 2018-08-01 08:45:04

←Older revision Revision as of 08:45, 1 August 2018
Line 14: Line 14:
-
There must be a way to request another resource while already holding some. If a thread can only request resource(s) while holding none (or there is some order of resources and those can be requested only in such order), a deadlock cannot be created.
+
There must be a way to request another resource while already holding some. If a thread can only request resource(s) while holding none (or there is some order of resources and those can be requested only in such order), a [[deadlock]] cannot be created.

JaroslavTulach: /* Resource waiting or circular wait */ - 2014-10-19 07:52:40

Resource waiting or circular wait

←Older revision Revision as of 07:52, 19 October 2014
Line 11: Line 11:
Nobody can take away a resource from a thread. If there was a supervisor, that could take the resource away, it could effectively solve all deadlocks by detecting them (which is easy) and then choosing a thread to loose its resource while letting others proceed.
Nobody can take away a resource from a thread. If there was a supervisor, that could take the resource away, it could effectively solve all deadlocks by detecting them (which is easy) and then choosing a thread to loose its resource while letting others proceed.
-
== Resource waiting or circular wait ==
+
== Incremental Requests ==
-
A circular chain of processes, with each process holding resources which are currently being requested by the next process in the chain, cannot exist. If it does, the cycle theorem (which states that "a cycle in the resource graph is necessary for deadlock to occur") indicated that deadlock could occur.
 
-
[http://www.google.com/search?q=four+necessary+condition+for+a+deadlock+to+appear&start=0&start=0&ie=utf-8&oe=utf-8 four necessary and also sufficient conditions]
+
There must be a way to request another resource while already holding some. If a thread can only request resource(s) while holding none (or there is some order of resources and those can be requested only in such order), a deadlock cannot be created.

JaroslavTulach: /* Hold and wait */ - 2014-10-19 07:51:44

Hold and wait

←Older revision Revision as of 07:51, 19 October 2014
Line 5: Line 5:
== Hold and wait ==
== Hold and wait ==
-
There must be a way to request another resource while already holding some. If a thread can only request resource(s) while holding none, a deadlock cannot be created.
+
A thread can hold and wait indefinitely. If it could not, and for example would time out, the deadlock can be resolved by letting the timed out thread to give up and release all resources.
== Cannot Take Away a Resource ==
== Cannot Take Away a Resource ==

JaroslavTulach: /* No pre-emption */ - 2014-10-19 07:49:27

No pre-emption

←Older revision Revision as of 07:49, 19 October 2014
Line 7: Line 7:
There must be a way to request another resource while already holding some. If a thread can only request resource(s) while holding none, a deadlock cannot be created.
There must be a way to request another resource while already holding some. If a thread can only request resource(s) while holding none, a deadlock cannot be created.
-
== No pre-emption ==
+
== Cannot Take Away a Resource ==
-
The processes must not have resources taken away while that resource is being used. Otherwise, deadlock could not occur since the operating system could simply take enough resources from running processes to enable any process to finish.
+
Nobody can take away a resource from a thread. If there was a supervisor, that could take the resource away, it could effectively solve all deadlocks by detecting them (which is easy) and then choosing a thread to loose its resource while letting others proceed.
== Resource waiting or circular wait ==
== Resource waiting or circular wait ==

JaroslavTulach: /* Hold and wait or partial allocation */ - 2014-10-19 07:47:36

Hold and wait or partial allocation

←Older revision Revision as of 07:47, 19 October 2014
Line 3: Line 3:
The resources involved must be exclusive. Once a thread gets on hold of a resource, nobody else can use it. Otherwise the concurrent threads would not be prevented from using the resource.
The resources involved must be exclusive. Once a thread gets on hold of a resource, nobody else can use it. Otherwise the concurrent threads would not be prevented from using the resource.
-
== Hold and wait or partial allocation ==
+
== Hold and wait ==
-
The processes must hold the resources they have already been allocated while waiting for other (requested) resources. If the process had to release its resources when a new resource or resources were requested, deadlock could not occur because the process would not prevent others from using resources that it controlled.
+
There must be a way to request another resource while already holding some. If a thread can only request resource(s) while holding none, a deadlock cannot be created.
== No pre-emption ==
== No pre-emption ==

JaroslavTulach: /* Mutual exclusion */ - 2014-10-19 07:46:26

Mutual exclusion

←Older revision Revision as of 07:46, 19 October 2014
Line 1: Line 1:
== Mutual exclusion ==
== Mutual exclusion ==
-
The resources involved must be unshareable; otherwise, the processes would not be prevented from using the resource when necessary.
+
The resources involved must be exclusive. Once a thread gets on hold of a resource, nobody else can use it. Otherwise the concurrent threads would not be prevented from using the resource.
-
 
+
== Hold and wait or partial allocation ==
== Hold and wait or partial allocation ==

JaroslavTulach: New page: == Mutual exclusion == The resources involved must be unshareable; otherwise, the processes would not be prevented from using the resource when necessary. == Hold and wait or partial al... - 2014-10-19 07:45:12

New page: == Mutual exclusion == The resources involved must be unshareable; otherwise, the processes would not be prevented from using the resource when necessary. == Hold and wait or partial al...

New page

== Mutual exclusion ==

The resources involved must be unshareable; otherwise, the processes would not be prevented from using the resource when necessary.


== Hold and wait or partial allocation ==

The processes must hold the resources they have already been allocated while waiting for other (requested) resources. If the process had to release its resources when a new resource or resources were requested, deadlock could not occur because the process would not prevent others from using resources that it controlled.

== No pre-emption ==

The processes must not have resources taken away while that resource is being used. Otherwise, deadlock could not occur since the operating system could simply take enough resources from running processes to enable any process to finish.

== Resource waiting or circular wait ==

A circular chain of processes, with each process holding resources which are currently being requested by the next process in the chain, cannot exist. If it does, the cycle theorem (which states that "a cycle in the resource graph is necessary for deadlock to occur") indicated that deadlock could occur.

[http://www.google.com/search?q=four+necessary+condition+for+a+deadlock+to+appear&start=0&start=0&ie=utf-8&oe=utf-8 four necessary and also sufficient conditions]