Operating system knowledge - the process deadlock

Description with a language they understand, if wrong, please madness on her face does not matter, want to be able to point it out.

0. definition of deadlock

More than two processes require the use of other resources already occupied, waiting for each other to form, making it impossible to continue to run.

1. Critical Condition

Resources set up for each process consumes k 1 , k 2 , k 3 · · ·, a total of n processes.
The system must not produce at least the number of resources for deadlock (not matter how the resources are allocated deadlock):
K = (K . 1 + K 2 + K . 3 + ????? + K n- ) -. 1 + n-
primary the idea is, give each process resource allocation, so that it can run short of a resource, and then assigned to a resource process to run, after the end of this process can release resources for other processes to use (just for this idea find the minimum number of resources, the actual allocation method is not necessarily so).
The following diagram, yellow as the allocation of resources, white unallocated resources, each process're just one resource to run, and then assign a resource to run for either a process, wait until the end of the release of resources, but also used by other processes, such I have no deadlock.

It really is the least resources required when wanton distribution, and a little too.
Take a look at a few situations when that may occur deadlock ,,, forehead, very simple, took the figure to speak.
There are three processes, n = 3
for each process resource requirements K . 1 =. 3, K 2 =. 6, K . 3 =. 5
when arbitrary dispensing, the system must not produce at least the number of resources required for the deadlock:
k = (3 + 6 + 5 ) - 3 + 1 = 12
if the system 11 only resources on the above case shown in FIG., each process're just one resource, other processes are waiting for resources, resulting in a deadlock.
11 and this is the maximum number of resources of the system deadlock , is represented by the formula (K . 1 + K 2 + K . 3 + ????? + K n- ) - n-.

2. create the necessary conditions for deadlock

  1. Mutually exclusive conditions
  2. Request to maintain the conditions
  3. Inalienable condition
  4. Loop condition

3. The process deadlock

  1. Ostrich strategy, that strategy does not ignore
  2. Prevention strategies
  3. Avoidance strategy: typical algorithms, banker's algorithm
  4. Detection Strategies Used to Relieve

To be continued, there is a new understanding to add.

Published 72 original articles · 87 won praise · Views 200,000 +

Guess you like

Origin blog.csdn.net/maizousidemao/article/details/102290962