ISRO Computer Science (CSE) 2025 - Question 69

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2025

Topic: Operating Systems

Consider a system with 3 processes P0 to P2 and 3 resource types A, B, and C. Resource type A has 10 instances, resource type B has 5 instances and resource type C has 7 instances. The following snapshot of the system has been taken at a given time.
Allocation: P0(0,1,0), P1(2,0,0), P2(3,0,2)
Max: P0(7,5,3), P1(3,2,2), P2(9,0,2)
Which of the following is true?

  • A. The system is not in safe state
  • B. The system is blocked
  • C. The system is in safe state
  • D. The request cannot be granted to all the processes

Answer: C. The system is in safe state

Explanation: Total resources = (10, 5, 7). Total allocated = P0(0,1,0) + P1(2,0,0) + P2(3,0,2) = (5, 1, 2).
Available resources = Total - Allocated = (10, 5, 7) - (5, 1, 2) = (5, 4, 5).
Calculate Need matrix (Max - Alloc):
P0 Need: (7, 5, 3) - (0, 1, 0) = (7, 4, 3)
P1 Need: (3, 2, 2) - (2, 0, 0) = (1, 2, 2)
P2 Need: (9, 0, 2) - (3, 0, 2) = (6, 0, 0)
Starting with Available = (5, 4, 5):
- P1's Need (1, 2, 2) <= (5, 4, 5). P1 runs and releases (2, 0, 0). New Available = (7, 4, 5).
- P2's Need (6, 0, 0) <= (7, 4, 5). P2 runs and releases (3, 0, 2). New Available = (10, 4, 7).
- P0's Need (7, 4, 3) <= (10, 4, 7). P0 runs.
Since all processes can finish in the sequence <P1, P2, P0>, the system is in a safe state.

| | All questions of ISRO Computer Science (CSE) 2025