0% found this document useful (0 votes)
54 views3 pages

操作系统课程作业 7

1) The document discusses operating system homework questions 7.5, 7.7, and 7.11 regarding the banker's algorithm and deadlocks. 2) In question 7.5, the document analyzes which changes to resource availability or process requirements can be made safely without introducing deadlock, including adding/removing resources or changing process maximum needs. 3) Question 7.7 proves a system is deadlock-free if process maximum needs are between 1 and the number of resources m, and total maximum needs are less than m + the number of processes n. 4) Question 7.11 provides the need matrix values for 5 processes, confirms the system is initially in a safe state, and

Uploaded by

Dwayne Herry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views3 pages

操作系统课程作业 7

1) The document discusses operating system homework questions 7.5, 7.7, and 7.11 regarding the banker's algorithm and deadlocks. 2) In question 7.5, the document analyzes which changes to resource availability or process requirements can be made safely without introducing deadlock, including adding/removing resources or changing process maximum needs. 3) Question 7.7 proves a system is deadlock-free if process maximum needs are between 1 and the number of resources m, and total maximum needs are less than m + the number of processes n. 4) Question 7.11 provides the need matrix values for 5 processes, confirms the system is initially in a safe state, and

Uploaded by

Dwayne Herry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

操作系统课程作业 7.5, 7.7, 7.

11

学号:2019290009

姓名:何威

作业题⽬
7.5

In a real computer system, neither the resources available nor the demands of processes
for resources are consistent over long periods (months). Resources break or are replaced,
new processes come and go, new resources are bought and added to the system. If
deadlock is controlled by the banker’s algorithm, which of the following changes can be
made safely (without introducing the possibility of deadlock), and under what
circumstances?

a. Increase Available (new resources added).

b. Decrease Available (resource permanently removed from system)

c. Increase Max for one process (the process needs more resources than allowed, it may
want more)

d. Decrease Max for one process (the process decides it does not need that many
resources)

e. Increase the number of processes.

f. Decrease the number of processes.

7.7
Consider a system consisting of m resources of the same type, being shared by n
processes. Resources can be requested and released by processes only one at a time. Show
that the system is deadlock free if the following two conditions hold:

a. The maximum need of each process is between 1 and m resources

b. The sum of all maximum needs is less than m + n

Answer the following questions using the banker’s algorithm:

a. What is the content of the matrix Need?

b. Is the system in a safe state?

c. If a request from process P1 arrives for (0,4,2,0), can the request be granted
immediately?

作业内容
7. 5

a. Increase Available (new resources added) - This could safely be changed


without any problems.
b. Decrease Available (resource permanently removed from system) - This could
have an effect on the system and introduce the possibility of deadlock as the
safety of the system assumed there were a certain number of available resources.
c. Increase Max for one process (the process needs more resources than allowed,
it may want more) - This could have an effect on the system and introduce the
possibility of deadlock.
d. Decrease Max for one process (the process decides it does not need that many
resources) - This could safely be changed without any problems.
e. Increase the number of processes - This could be allowed assuming that
resources were allocated to the new process(es) such that the system does not
enter an unsafe state.
f. Decrease the number of processes - This could safely be changed without any
problems. 7.6 Consider a system consisting of f

7.11

a. What is the content of the matrix Need? The values of Need for processes P0 through
P4 respectively are (0, 0, 0, 0), (0, 7, 5, 0), (1, 0, 0, 2), (0, 0, 2, 0), and (0, 6, 4, 2).

b. Is the system in a safe state? Yes. With Available being equal to (1, 5, 2, 0), either
process P0 or P3 could run. Once process P3 runs, it releases its resources which allow all
other existing processes to run.

c. If a request from process P1 arrives for (0,4,2,0), can the request be granted
immediately? Yes it can. This results in the value of Available being (1, 1, 0, 0). One
ordering of processes that can finish is P0, P2, P3, P1, and P4

You might also like