Self Studies

Operating System Test 4

Result Self Studies

Operating System Test 4
  • Score

    -

    out of -
  • Rank

    -

    out of -
TIME Taken - -
Self Studies

SHARING IS CARING

If our Website helped you a little, then kindly spread our voice using Social Networks. Spread our word to your readers, friends, teachers, students & all those close ones who deserve to know what you know now.

Self Studies Self Studies
Weekly Quiz Competition
  • Question 1
    1 / -0
    Consider a system having 'N' resources of the same type. X, Y and Z are the three processes that shared the resource. The peak demand of X, Y and Z are 5, 11, and 9 respectively. What is the maximum value of 'N' to ensures the system is in deadlock?
    Solution

    Data:

    number of processes = 3

    The available instance of Resources = N

    Max needs of process (X, Y, Z) = (5, 11, 9)

    Calculation

    Deadlock can occur: needed (requested) resource > available resources

    Max resource per process to be in deadlock = needed – 1.

    Nmax = (5 - 1) + (11 - 1) + (9 - 1) = 4 + 10 + 8 = 22

  • Question 2
    1 / -0

    The total number of instances of a resource is 11. Four processes A, B, C, and D are present in the system. The allocation table of the resources is given below. 

    Process

    Max. Need

    Current Allocation

    D

    9

    1

    C

    5

    4

    B

    10

    3

    A72

     

    Which of the following orders of process execution forms a deadlock-free sequence?

    Solution

    Process

    Max. Need

    Current Allocation

    Need = Max – current allocation

    D

    9

    1

    8

    C

    5

    4

    1

    B

    10

    3

    7

    A725


    Total resources that are currently allocated = 1 + 4 + 3 + 2 = 10

    Total available = 11

    Current available = 11 – 10 = 1 resources

    With 1 resource, we can satisfy the need of C.

    After this, resources allocated to C added to current available.

    New current available = 1 + 4 = 5

    With 5 resources we can fulfil the need of A

    new current available = 5 + 2 = 7,

    With 7 resources need of B can be easily satisfied.

    new current available = 7 + 3 = 10,

    With 10 resources need of D can be easily satisfied.

    So, the correct order is <C, A, B, D>

  • Question 3
    1 / -0

    Which of the below-given statement is/are true?

    1. Deadlock is waiting for a resource from a process that will never release it resource.
    2. Banker’s Algorithm is used to avoid deadlock in a system.
    Solution
    • Deadlock is infinite waiting in which process is waiting for an event that will never occur
    • Banker’s algorithm detects the unsafe state and hence prevent the system in going to deadlock state
  • Question 4
    1 / -0

    Consider a system in which there are P processes. A1, A2, … AP is the processes that share K identical resource units, which can be reserved and release at a time. The peak requirement per process is Xi. Which of the following condition is necessary to say that the system is in deadlock state?(Assume Xi > 0)

    Solution

    Process

    A1

    A2

    A3

    A4

    ..

    Ap

    Maximum need

    X1

    X2

    X3

    X4

    ..

    Xn

    Total resource = K

    For the system to be in a deadlock

    (X1 – 1) + (X2 – 1) + (X3 – 1) + (X4 – 1)... (Xp – 1)  ≥ K

    \(\mathop \sum \limits_{i = 1}^P {X_i} - P \ge K\)

    \(\mathop \sum \limits_{i = 1}^P {X_i} \ge K + P\)

  • Question 5
    1 / -0

    An operating system uses the Banker’s algorithm for deadlock avoidance when managing the allocation of three resource types A, B, and C to four processes P0, P1, P2, and P3.

    Process

    Allocation

    Max

    Available

     

    A

    B

    C

    A

    B

    C

    A

    B

    C

    P0

    4

    3

    3

    5

    4

    4

    3

    2

    2

    P1

    1

    2

    0

    3

    2

    0

    P2

    3

    0

    1

    6

    0

    2

    P3

    1

    1

    0

    2

    1

    1

     

    Which of the following best describes the current state of the system?
    Solution

    Need = Max – Allocation

    Process

    Need

     

    A

    B

    C

    P0

    1

    1

    1

    P1

    2

    0

    0

    P2

    3

    0

    1

    P3

    1

    0

    1

    Here, Need < available. Hence, the system is in the safe state and not deadlocked.

  • Question 6
    1 / -0

    Which of the following statements are True?

    I. All unsafe states are deadlocks.

    II. A deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that a circular-wait condition can never exist.

    III. To eliminate deadlock if a process and resources are selected for preemption on the basis of cost leads to starvation.

    Solution

    1. False: A deadlocked state is an unsafe state. Not all unsafe states are deadlocks, however an unsafe state may lead to a deadlock.

    2. True: A method for avoiding deadlocks, requires that the operating system have a priori information about how each process will utilize system resources. The resource allocation state is defined by the number of available and allocated resources and the maximum demands of the processes.

    3. True: In a system that selects victims i.e. processes and resources for rollback primarily on the basis of cost factors, starvation may occur, and the selected process can never complete its designated task.
  • Question 7
    1 / -0
    In a computer system, 28 processes are present and they share R resources of the same type. Each process can request a maximum of 5 resources. What is the minimum value of R such that no deadlock occurs?
    Solution

    Data:

    number of process = n = 28

    The available instance of Resources = R 

    Max needs per process = 5

    Concepts:

    Deadlock can occur: needed (requested) resource > available resources

    Max resource per process to be in deadlock = needed – 1 = 5 – 1 = 4

    For n process, max resource to be in deadlock = 4 × n = 4n

    If one instance is added, any of the n processes can take it a finish its execution leaving behind the allocated resource, and hence the system will be deadlock-free.

    Formula:

    For n process, min resource for the system not to be in deadlock state = 4n + 1 ≤ R

    Calculation:

    4×(28) + 1 ≤ R

    113 ≤ R

    Tips and Tricks:

    n × (m - 1) + 1 ≤ R

    where n is the number of processes

    m is the maximum resource need per process

    R is the available system resources.

  • Question 8
    1 / -0

    An operating system uses the banker's algorithm for deadlock avoidance to manage the allocation of four resources A, B, C, and D. The table given below represents the current system state.

     

    Allocation

    Max

     

    A

    B

    C

    D

    A

    B

    C

    D

    P1

    1

    2

    1

    0

    1

    3

    1

    2

    P2

    3

    1

    2

    1

    5

    3

    2

    1

    P3

    4

    2

    3

    0

    7

    2

    3

    4

    P4

    0

    0

    1

    5

    1

    1

    3

    6

     

    There are 3 units of type B, 2 units of type D still available. Which of the following sequence is a safe sequence?

    Solution

    Available = {0, 3, 0, 2}

     

    Allocation

    Max

    Needed

     

    A

    B

    C

    D

    A

    B

    C

    D

    A

    B

    C

    D

    P1

    1

    2

    1

    0

    1

    3

    1

    2

    0

    1

    0

    2

    P2

    3

    1

    2

    1

    5

    3

    2

    1

    2

    2

    0

    0

    P3

    4

    2

    3

    0

    7

    2

    3

    4

    3

    0

    0

    4

    P4

    0

    0

    1

    5

    1

    1

    3

    6

    1

    1

    2

    1

     

    The given system is not in a safe state.

  • Question 9
    1 / -0

    Which of the following is/are not true about the deadlock scheme?

    I.  In deadlock avoidance, number the resource uniquely and never requests a lower-numbered resource

    II. In deadlock avoidance, the request for the resources is always granted if the resulting state is safe.

    III. In deadlock prevention, never request a resource after releasing any resource.

    Solution

    Statement I: not true (False)

    In deadlock prevention, number the resource uniquely and never requests a lower-numbered resource

    Statement II:  True

    In deadlock avoidance, the request for the resources is always granted if the resulting state is safe.

    Statement IIi: not true (False)

    In deadlock prevention, the request can be made after releasing the resource

    Statement I and III are not true

Self Studies
User
Question Analysis
  • Correct -

  • Wrong -

  • Skipped -

My Perfomance
  • Score

    -

    out of -
  • Rank

    -

    out of -
Re-Attempt Weekly Quiz Competition
Selfstudy
Selfstudy
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now