** Let n processes, each process’s maximum demand for resources of class R is w, and the value of m that will never deadlock is judged as m =n (w-1) +1. In the question, a deadlock may occur if m< m, and a deadlock will never occur if m>= m *

Reference:

Assume that there are m resources of class R in the system, and there are n mutually exclusive processes. If the maximum demand of R resource for each process is W, then when M, N, and W take the values of the following table, deadlock may occur in (8) two of the five cases A ~ E in the table below. In both cases, a deadlock will not occur if (9) is applied.

(8)A, B, C, C, D, E

(9)A.n plus 1 or W plus 1 B.m plus 1 or W minus 1

C.m minus one or w plus one D.m minus one or w minus one

A. is B. is C. is D. is

“Resolution”

(8) What is the basic knowledge of operating system deadlock? Improper allocation of the same kind of resources in the system can cause deadlock. In general, if there are m units of memory resources in the system and it is used by n processes, when each process requires w units of memory resources, when m<nw, deadlock may be caused.

Question (8) is analyzed as follows:

In case A: M =2, N = L, W =2, there are two resources in the system, and one process uses them. This process requires at most two resources, so deadlock will not occur.

Case B: M =2, N =2, W = L, there are two resources in the system, two processes use, each process requires at most one resource, so there will be no deadlock.

C: M = 2, n = 2, w = 2, the system has two resources, two process, each process requires two resources, most at this time, the distribution strategy is to take turns to each process, the distribution system for each of the first process in the first round 1, at this point, the system has no for the allocation of resources, making every process in a wait state system leads to a deadlock, The process resource diagram is shown below.



D: M = 4, n = 3, w = 2, the system has four resources, three processes, each process requires two resources, most at this time, the distribution strategy is to take turns to each process, is the first round of the system to allocate a resource for each process, at this point, the system still remain a resources, can make one of the process to get the resources needed and run, So there is no deadlock. .

E: M = 4, n = 3, w = 3, the system has four resources, three processes, each process requires three most resources, at this point, the distribution strategy is to take turns to each process, the distribution system for each of the first process in the first round, second round system for assigning a 1 first, at this point, the system has no for the allocation of resources, Making each process in the waiting state causes the system to deadlock, and then the process resource diagram is shown in the figure below.

(9) For cases C and E, if m is added by 1, then case C: M = 3, + n = 2, w = 2, the system has three resources, using two process, each process requires two resources, most systems for each of the first process assignment 1, at this point, the system of the remaining one is available for allocation of resources, make one of the process is performed to get the required resources, and release all the resources to make another process is running; If W is reduced by 1, then C: M =2, N =2, W = L, there are two resources in the system, one is needed for each process, and the system allocates one for each process. At this time, all processes can finish running, and obviously no deadlock will occur. Same thing with analysis E.