0% found this document useful (0 votes)
23 views

Assignment#3 OS

The document outlines an assignment with two questions focused on determining if a system is in a safe state using the Banker's Algorithm. Each question presents a scenario with processes and resource types, requiring the computation of Remaining Need and the application of the algorithm to assess safety. The assignment is due on January 24, 2025, and is worth 20 marks in total.

Uploaded by

lunadope1419
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Assignment#3 OS

The document outlines an assignment with two questions focused on determining if a system is in a safe state using the Banker's Algorithm. Each question presents a scenario with processes and resource types, requiring the computation of Remaining Need and the application of the algorithm to assess safety. The assignment is due on January 24, 2025, and is worth 20 marks in total.

Uploaded by

lunadope1419
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ASSIGNMENT#3

Deadline of Submission: 24 January 2025

Question 1: Determine if the system is in a safe state

A system has 5 processes (P0 to P4) and 3 resource types (A, B, C). Use the Banker's Algorithm
to determine if the system is in a safe state. The data is organized as follows:

Process Allocated Max Need


(A, B, C) (A, B, C)
P0 0, 1, 0 7, 5, 3
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
(10 Marks)
Total Resources (A, B, C) = (10, 5, 7)
Steps:

1. Compute the Remaining Need using the formula:


Remaining Need = Max Need - Allocated

2. Check if the system is in a safe state by applying the Banker's Algorithm:

 Find a process whose Remaining Need can be satisfied with the current
Availability.
 If such a process exists, allocate its resources temporarily, release the
allocated resources back to the system, and update the Availability.
 Repeat until all processes are executed, or determine that the system is not in
a safe state.
Question 2: Determine if the system is in a safe state

A system has 5 processes (P0 to P4) and 4 resource types (A, B, C, D). Use the Banker's
Algorithm to determine if the system is in a safe state. The data is organized as follows:

Process Allocated Max Need


(A, B, C, D) (A, B, C, D)
P0 1, 0, 0, 1 7, 5, 3, 4
P1 2, 1, 1, 1 3, 2, 2, 2
P2 3, 1, 2, 1 9, 0, 2, 3
P3 2, 1, 0, 2 2, 2, 2, 2
P4 1, 0, 2, 0 4, 3, 3, 1
(10 Marks)
Total Resources (A, B, C, D): (10, 5, 7, 6)

Steps:

1. Compute the Remaining Need using the formula:


Remaining Need = Max Need - Allocated

2. Check if the system is in a safe state by applying the Banker's Algorithm:

 Find a process whose Remaining Need can be satisfied with the current
Availability.
 If such a process exists, allocate its resources temporarily, release the
allocated resources back to the system, and update the Availability.
 Repeat until all processes are executed, or determine that the system is not in
a safe state.

You might also like