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

OS-Assignment-3 Deadlock CSE G

Uploaded by

Aditya Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

OS-Assignment-3 Deadlock CSE G

Uploaded by

Aditya Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MANIPAL UNIVERSITY JAIPUR

2022-23-EVEN SEMESTER

IV SEMESTER CSE-G

OPERATING SYSTEMS
ASSIGNMENT ON DEADLOCK

1. What is Deadlock? What are the four essential conditions for deadlock to occur?
2. Consider a system consisting of many processes and multiple resource types with
multiple /single instances of each type. Write a function in ‘C’ to check whether
the system is safe or not? (Use Bankers Algorithm). Assume that the data
structures required are global.
3. Consider a system with the following current resource-allocation state:
There are five processes P0, P1,P2,P3,P4 and three resource types: A,B,C and D.
For each process, the current allocation and the maximum required allocation
are given by the ALLOCATION and MAX matrices. The current available resources
are given by the AVAILABLE vector.

PROCESS ALLOCATION MAX AVAILABLE


A B C D A B C D A B C D
P0 2 0 0 1 4 2 1 2 3 3 2 1
P1 3 1 2 1 5 2 5 2
P2 2 1 0 3 2 3 1 6
P3 1 3 1 2 1 4 2 4
P4 1 4 3 2 3 6 6 5

Answer the following questions using the banker’s algorithm:


i). Illustrate that the system is in a safe state by demonstrating an order in
which the processes may complete.
ii). If a request from process P1 arrives for (1, 1, 0, 0), can the request be granted
immediately?
If a request from process P4 arrives for (0, 0, 2, 0), can the request be granted
immediately?
4. Consider a system with the following current resource-allocation state:
There are five processes P0, P1,P2,P3,P4 and three resource types: A,B, and C. For
each process, the current allocation and the maximum required allocation are
given by the ALLOCATION and MAX matrices. The current available resources
are given by the AVAILABLE vector.

PROCESS ALLOCATION MAX AVAILABLE


A B C A B C A B C
P0 1 1 2 4 3 3 2 1 0
P1 2 1 2 3 2 2
P2 4 0 1 9 0 2
P3 0 2 0 7 5 3
P4 1 1 2 11 2 3
a) Determine the total amount of resources of each type?
b) What is the “NEED” matrix?
c) Determine whether the system is in safe state using Bankers Algorithm?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy