You may assume a static number of processes 5 and a static n

You may assume a static number of processes (5) and a static number of resources (4).

Name: \"input3.txt\"

Line 1: Available resources

Line 2 to line n+1: Where n is the number of processes. The resources the processes have currently (the allocation) and the resources they need (the max)

Line n+2: The available resources

Line n+3: a blank line

Line n+4 and onward: A process request, such as in 7.3 part c. The process making the request, followed by the amount of each resource they want. You should continually process these lines until there are none left. Output whether or not the request can be granted. Do not allow these requests to impact the system, they are purely theoretical. Answer CAN the request be granted, do not actually grant the request.

It should look something like this:

1 5 2 0

0 0 1 2 0 0 1 2

1 0 0 0 1 7 5 0

1 3 5 4 2 3 5 6

0 6 3 2 0 6 5 2

0 0 1 4 0 6 5 6

0 1 5 2 0

1 4 5 2 0

Consider the following snapshot of a system: Allocation Max Available A BCD A BCD A BCD Po 0012 0012 1520 Ph 1000 17 50 1354 2356 P3 0632 0652 Pa 0014 0656 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 Ph arrives for (0,4,2,0), can the request be granted immediately?

Solution

Banker\'s Algorithm :-

5 processes and 4 resource type A(with 3), B(with 14), C(with 12) and D(with 12 instance).

a)content of matrix need---->

b) Yes, system is in safe state. <P0, P2, P1, P3, P4> is a safe sequence.

c)Yes, if a request from process P1 arrives for (0,4,2,0) then the request be granted immediately. Because available resource is (1,5,2,0) in starting.

Allocation Max Need Available
ABCD ABCD ABCD ABCD
P0 0012 0012 0000 1520
P1 1000 1750 0750
P2 1354 2356 1002
P3 0632 0652 0020
P4 0014 0656 0642
You may assume a static number of processes (5) and a static number of resources (4). Name: \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site