Operating Systems 173323 (3 cu)

Exercise 10

Week 51

Exercises 10 are in computer classes:

Group 1: on Monday Dec. 17 at 14-16 in T/B178
Group 2: on Monday Dec. 17 at 10-12 in T/B178

  1. Consider the following resource allocation graph:
    P = {P1,P2,P3,P4}
    R = {R1,R2,R3}
    E = {R1 --> P1, P1 --> R2, R2 --> P2, P2 --> R3,
         R3 --> P3, P3 --> R1, R1 --> P4}
    
    - resource type R1 has two instances
    - resource type R2 has one instance
    - resource type R3 has one instance

    Draw a resource allocation graph and explain the possibility for a deadlock.

  2. Consider the following resource allocation graph:
    P = {P1,P2,P3}
    R = {R1,R2,R3}
    E = {R1 --> P1, P1 --> R2, R2 --> P2, P2 --> R3,
         R3 --> P3, P3 --> R1}
    
    - resource type R1 has one instance
    - resource type R2 has one instance
    - resource type R3 has one instance

    Draw a resource allocation graph and explain the possibility for a deadlock.

  3. Consider the following situation, in which there are 3 processes and the total number of recources is 12.

    Process   Current needs   Maximum needs
    ---------------------------------------
      P1            5              10 
      P2            2               4
      P3            2               9
    

    Is the state above safe or unsafe ?

    In the next state, process P1 needs two more resources. Is the state then safe or unsafe ?

  4. Consider a disk that has 200 cylinders (from 0 to 199). Disk arm (read/write head) is currently in position 143 and before that it was in position 125. Consider a queue of requests: 86, 147, 91, 177, 94, 150, 102, 175, 130.

    Calculate the total number of disk arm movements needed, when the disk scheduling is done using:

    a) FCFS
    b) SSTF
    c) SCAN
    d) C-SCAN

    Draw also a figure to visualize the disk arm movement in every scheduling.

    The copies of the material for this task are available in Rekursio's room.