ITCS 409-Operating Systems

Krita Informatics Best Academic Writing Services
Krita Informatics Best Academic Writing Services

An operating system uses the Banker’s algorithm for deadlock avoidance when managing the
allocation of four resource types A, B, C and D to four processes P1, P2, P3 and P4. Resource
type A has 6 instances, B has 4 instances, type C has 3 instances and type D has 3 instances. The
table given below presents the current system state. Here, the allocation matrix shows the current
number of resources of each type allocated to each process and the Max matrix shows the
maximum number of resources of each type required by each process during its execution.

Available Allocation Max Processe
s

D C B A D C B A D C B A
1 1 1 1 1 1 1 1 2 1   2  2  P0
0 0 1 1 0 1 1 1 P1
1 1 0 3 1 1 1 4 P2
0 0 1 0 2 0 2 0 P3

Answer the following questions considering the above case study:

  1. What will be the content of the Need matrix?
    Need matrix can be found by subtracting max of processes from allocation of processes

Need matrix = max – allocation

Processes A B C D
P0 1 1 0 1
P1 0 0 1 0
P2 1 1 0 0
P3 0 1 0 2

  1. Apply the Safety algorithm on the given case study and provide the results.
    P0 is in Safe state
    Available = 1 1 1 1
    P0 [need] < available
    P0 is executed
    Finding the availability of P1
    Available upon successful execution of P0 [available ] new = 1111 + 1111
    = 2222
    P1 [need ]< Available new
    P1 will be executed
    P1 executes successfully
    Available[ new] = Available of P1 + Allocation of P1
    2222 + 1100
    33 22
    NOW P2 will executed
    Available[ new] = available of P1 + allocation P2
    33 22 + 30 11
    = 6333

Now P3 will be executed
Available [new ]= available of P2 + Allocation p3
6333 + 01 00
=6433
It is safely executed
Safe state sequence = P0 P1 P2 P3

  1. Consider the following independent requests for additional resources in the
    current state:

To Examine the safe state of the system in case of serving REQ1 and REQ2, independently.
Max of P0 = Max A + REQ P0
2 2 1 2 + 1 0 1 0
= 3 2 2 2
Need P0 = max P0 – available
= 3 2 2 2 – 1 1 1 1
= 2 1 1 1
need > available
P0 is rejected
max P1 = max A + REQ P1
1 1 1 0 + 0 0 1 1
= 1 1 2 1
need of P1 = max P1 – allocation
= 1 1 2 1 – 1 1 1 1
= 0 0 1 0
REQ1: P0 requests 1 units of A, 0 units of B, 1 units of C and 0 units of D
REQ2: P1 requests 0 units of A, 0 units of B, 1 units of C and 1 units of D

P1 is in safe state

  1. Draw the resource- allocation graph for the given system.

Collaboration and assignment rules
The work must be all your own. Do not copy any parts of any of the assignments from anyone.
Do not make any parts of your assignments available to anyone, and make sure none can read
your files. The university policies on academic integrity will be applied rigorously. The Turnitin
system will be used to check the similarity of the assignment and the acceptable similarity is
15% ONLY. The total mark of this assignment is 20% of the total course work. Upload your
assignment to the Moodle system of Ahlia University before the indicated deadline date.
Assessment Rubric:
Assessment ILOs Mark

Q1 B1 4
Q2 B1 4
Q3 B1 4
Q4 B2 4
Discussion & presentation D1 2
Handing over the assignment on
Time

D3 2

Total: 20 marks

Leave a Comment