Back to the 2023 paper

Module 4: Deadlocks

20237m

Consider a system with five processes P0 through P4 and have three resource types A, B, C. Resource type A has ten instances, resource type B has five instances, and resource type C has seven instances. Suppose that the following snapshot represents the current state of the system:

Allocation Max Available
A B C A B C A B C
P0 0 1 0 7 5 3 3 3 2
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 2 2 2
P4 0 0 2 4 3 3

The system is currently in safe state. Suppose now that P1 requests additional resources as (A=1, B=0, C=2). Is this request can be immediately granted? Justify your answer.

Worked SolutionAI Assisted

Banker's Request P1 (1,0,2) with Available 3,3,2

Check Need P1 = Max-Alloc = 1,2,2. Request 1,0,2 ≤ Need (1,2,2) and ≤ Available (3,3,2) → pretend allocate: Avail becomes 2,3,0, Alloc P1 becomes 3,0,2.
Check safe: Need remaining: P0 7,4,3, P1 0,2,0, P2 6,0,0, P3 0,1,1, P4 4,3,1. No safe sequence because Avail 2,3,0 insufficient for any Need → request cannot be granted, would lead to unsafe state, P1 must wait.

Similar questions

Operating SystemConsider a system with five processes P0 through P4 and four resources type A, B, C and D. Using the Banker's algorithm answer that the system is in a safe state? | Process | Allocation (A B C D) | Max (A B C D) | Available (A B C D) | | :--- | :---: | :---: | :---: | | P0 | 0 0 1 2 | 0 0 1 2 | 1 5 2 0 | | P1 | 1 0 0 0 | 1 7 5 0 | | | P2 | 1 3 5 4 | 2 3 5 6 | | | P3 | 0 6 3 2 | 0 6 5 2 | | | P4 | 0 0 1 4 | 0 6 5 6 | |20257mOperating SystemConsider a system with five processes P0 through P4 and four resources type A, B, C and D. Using the Banker's algorithm answer that the system is in a safe state? | | Allocation | Max | Available | | :--- | :--- | :--- | :--- | | | A B C D | A B C D | A B C D | | P0 | 0 0 1 2 | 0 0 1 2 | 1 5 2 0 | | P1 | 1 0 0 0 | 1 7 5 0 | | | P2 | 1 3 5 4 | 2 3 5 6 | | | P3 | 0 6 3 2 | 0 6 5 2 | | | P4 | 0 0 1 4 | 0 6 5 6 | |20247mOPERATING SYSTEMConsider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock-free.20227mOperating SystemA single processor system has three resource types X, Y and Z, which are shared by three processes. There are 5 units of each resource type. Consider the following scenario, where the column 'alloc' denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type requested by a process in order to complete execution. Find the process that will finish first and last. | | alloc<br>X Y Z | Request<br>X Y Z | |---|---|---| | P0 | 1 2 1 | 1 0 3 | | P1 | 2 0 1 | 0 1 2 | | P2 | 2 2 1 | 1 2 0 |20227m
Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.