COMP 2432 Operating Systems Tutorial 11
1. Safety of Resource Allocation State.
Given the following two resource allocation states (left and right) for five processes with three types of resources, the number of currently available resources is (3 0 2). What is the total number of each type of resources? Determine whether each of these two states (a) and (b) is safe. Give a safe sequence in case that it is safe.
(a) Allocation Max (b) Allocation Max ABCABC ABCABC
Copyright By PowCoder代写 加微信 powcoder
P0 220322 P1 200323 P2 102512 P3 211222 P4 102233
Suppose that P4 in (a) now refines its maximum demand from (2 3 6) down to (2 3 5). Determine whether the same resource allocation state is safe.
Suppose that P3 in (b) now refines its maximum demand from (2 2 2) up to (2 3 4). Determine whether the same resource allocation state is safe.
2. Deadlock Avoidance.
Could the following requests by P3 and P4 be granted with respect to the two resource allocation states (a) and (b) below? If a request could be granted, what would be an appropriate safe sequence for the new state? How many possible safe sequences are there for each of the two cases?
(a) Allocation Max (b) Allocation Max ABCABC ABCABC
Avail 3 Req3 2
1 0 0 0 0 2 1 1 1 2 0 5 0 1
533 312 432 412 223
P0 2 P1 3 P2 2 P3 1 P4 1
Avail 3 Req4 3
1 0 623 1 0 312 1 1 315 0 2 222 0 2 436 0 5
Suppose that the requesting process in (a) is not P3, but by another unknown process Px (x 3). Without knowing what x is, could the request be granted? Would the decision change if the requesting process in (b) is P0 instead of P4?
3. Deadlock Detection.
Determine whether each of the following two resource allocation states represents a deadlocked state. Give a completion sequence if there is no deadlock. Otherwise, indicate the set of processes involved in the deadlock. How many possible completion sequences are there for each case?
(a) Allocation Request (b) Allocation Request ABCABC ABCABC
1 0 0 0 0 2 1 1 1 2 0 0
012 305 211 000 201
P0 2 P1 2 P2 0 P3 1 P4 2
1 0 012 0 1 304 1 2 211 0 0 000 1 1 202 0 1
Suppose that the only available resource, A, in (a) is now broken. Is the new resource allocation state deadlocked? Consider the resource allocation state in (b), in which an instance of resource B has been repaired and returned to the system, such that the available array becomes (1 1 1). Is the state in a deadlocked state? If not, give some possible completion sequences.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com