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

OSY Final MICROPROJECT

This document discusses a micro project on Banker's and Safety algorithms for deadlock detection and avoidance. It provides background on deadlock detection algorithms in operating systems and describes the Banker's algorithm and Safety algorithm along with their advantages, disadvantages and applications.

Uploaded by

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

OSY Final MICROPROJECT

This document discusses a micro project on Banker's and Safety algorithms for deadlock detection and avoidance. It provides background on deadlock detection algorithms in operating systems and describes the Banker's algorithm and Safety algorithm along with their advantages, disadvantages and applications.

Uploaded by

Feroz K
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

A MICRO PROJECT ON

" Banker’s & Safety algorithm for


deadlock detection and avoidance "

MICRO PROJECT REPORT

Sr.No Roll no: Name of the student Enrollment no: Seat No

1 07 Kulsoom Feroz Kazi 2117340029 275120

Under the Guidance of


Prof.

In
Three Years Diploma Program in Engineering & Technology of Maharashtra
State Board of Technical Education, Mumbai (Autonomous)
ISO 9001:2008 (ISO\IEC-27001.2013)

At

1734-TRINITY POLYTECNIC PUNE

This is to certify that Mr./Ms. Kulsoom Feroz Kazi


Roll No:__07__of Fifth Semester
Diploma Program in
Computer Engineering
Technology at 1734- Trinity Polytechnic Pune has completed the
Micro project
satisfactorily in Subject Operating System in
the academic year 2022-2023 as per the MSBTE prescribed
curriculum of I
scheme.
Place: Pune
Enrollment No: 2117340029
Date: \ \2022
Exam Seat No: 275120
Index
SR NO TOPICS

1 AIMS/BENEFITS OF THE MICRO PROJECT

2 PROPOSED METHODOLOGY

WHAT IS A DEADLOCK DETECTION ALGORITHM IN


3 OPERATING SYSTEMS?

ADVANTAGES OF DEADLOCK DETECTION ALGORITHMS


4 IN OPERATING SYSTEMS:

DISADVANTAGES OF DEADLOCK DETECTION


5 ALGORITHMS IN OPERATING SYSTEMS:

6 WHY BANKER’S ALGORITHM IS NAMED SO?

7 SAFETY ALGORITHM

8 APPLICATIONS OF THIS MICRO-PROJECT:

SKILL DEVELOPED / LEARNING OUT OF THIS MICRO-


9
PROJECT:
Aims/Benefits of the
Micro Project

An Operating System is basically a system


program that controls the execution of
application programs and acts as an interface
between applications and the computer
hardware. It manages the computer system
resources to be used in an efficient manner. This
course enables one to learn the internal
functioning of operating systems and will help in
identifying appropriate Operating Systems for
given applications/tasks. This course is also a
prerequisite for the group of courses included in
the 'Cloud Infrastructure Maintenance' Elective
group.
Proposed methodology

 We will concentrate on the materials we


require, as well as the instructions, and sort it
out in a manner that will expedite the
various duties of the team members.
 Get details about the algorithms and how
they are used to detect and avoid deadlock.
 Solve the problems (examples) based on
algorithms to detect and avoid deadlock.
 Cross-check all the conclusions and
answers.
What is a deadlock detection algorithm in
operating systems?

A deadlock detection algorithm is a technique used by an


operating system to identify deadlocks in the system. This
algorithm checks the status of processes and resources to
determine whether any deadlock has occurred and takes
appropriate actions to recover from the deadlock.
The algorithm employs several times varying data
structures:
Available –
A vector of length m indicates the number of available
resources of each type.
Allocation –
An n*m matrix defines the number of resources of
each type currently allocated to a process. The column
represents resource and rows represent a process.
Request –
An n*m matrix indicates the current request of each
process. If request[i][j] equals k then process Pi is
requesting k more instances of resource type Rj.
Advantages of Deadlock Detection Algorithms in
Operating Systems:

Improved System Stability: Deadlocks are a


major concern in operating systems, and
detecting and resolving deadlocks can help to
improve the stability of the system.
Better Resource Utilization: By detecting
deadlocks and freeing resources, the operating
system can ensure that resources are
efficiently utilized and that the system remains
responsive to user requests.
Easy Implementation: Some deadlock
detection algorithms, such as the Wait-For
Graph, are relatively simple to implement and
can be used in a wide range of operating
systems and systems with different resource
allocation and synchronization requirements.
Disadvantages of Deadlock Detection Algorithms
in Operating Systems:

Performance Overhead: Deadlock detection algorithms can


introduce a significant overhead in terms of performance, as
the system must regularly check for deadlocks and take
appropriate action.
Complexity: Some deadlock detection algorithms, such as the
Resource Allocation Graph or Timestamping, are more
complex to implement and require a deeper understanding of
the system and its behavior.
False Positives and Negatives: Deadlock detection algorithms
are not perfect and may produce false positives or negatives,
indicating the presence of deadlocks when they do not exist
or failing to detect deadlocks that do exist.
Overall, the choice of deadlock detection algorithm depends
on the specific requirements of the system, the trade-offs
between performance, complexity, and accuracy, and the risk
tolerance of the system. The operating system must balance
these factors to ensure that deadlocks are detected and
resolved effectively and efficiently.
Why Banker’s algorithm is named so?

Banker’s algorithm is named so because it is used in the


banking system to check whether a loan can be sanctioned to
a person or not. Suppose there are n number of account
holders in a bank and the total sum of their money is S. If a
person applies for a loan then the bank first subtracts the
loan amount from the total money that the bank has and if
the remaining amount is greater than S then only the loan is
sanctioned. It is done because if all the account holders come
to withdraw their money then the bank can easily do it.

In other words, the bank would never allocate its money in


such a way that it can no longer satisfy the needs of all its
customers. The bank would try to be in a safe state always.

The following Data structures are used to implement the


Banker’s Algorithm:
Let ‘n’ be the number of processes in the system and ‘m’ be
the number of resource types.
Available :
It is a 1-d array of size ‘m’ indicating the number of available resources of
each type.
Available[ j ] = k means there are ‘k’ instances of resource type Rj
Max :

It is a 2-d array of size ‘n*m’ that defines the maximum demand of each
process in a system.
Max[ i, j ] = k means process Pi may request at most ‘k’ instances of
resource type Rj.
Allocation :

It is a 2-d array of size ‘n*m’ that defines the number of resources of each
type currently allocated to each process.
Allocation[ i, j ] = k means process Pi is currently allocated ‘k’ instances of
resource type Rj
Need :

It is a 2-d array of size ‘n*m’ that indicates the remaining resource need of
each process.
Need [ i, j ] = k means process Pi currently needs ‘k’ instances of resource
type Rj
Need [ i, j ] = Max [ i, j ] – Allocation [ i, j ]
Allocation specifies the resources currently allocated to process Pi and Needi
specifies the additional resources that process Pi may still request to
complete its task.
Banker’s algorithm consists of a Safety algorithm and a Resource request
algorithm.
Safety Algorithm

The algorithm for finding out whether or not a system is in


a safe state can be described as follows:

1) Let Work and Finish be vectors of length ‘m’ and ‘n’


respectively.
Initialize: Work = Available
Finish[i] = false; for i=1, 2, 3, 4….n
2) Find an i such that both
a) Finish[i] = false
b) Needi <= Work
if no such i exists goto step (4)
3) Work = Work + Allocation[i]
Finish[i] = true
goto step (2)
4) if Finish [i] = true for all i
then the system is in a safe state
As the processes enter the system, they must predict the maximum
number of resources needed which is impractical to determine.
In this algorithm, the number of processes remain fixed which is not
possible in interactive systems.
This algorithm requires that there should be a fixed number of
resources to allocate. If a device breaks and becomes suddenly
unavailable the algorithm would not work.
Overhead cost incurred by the algorithm can be high when there
are many processes and resources because it has to be invoked for
every processes.
Applications of this Micro-Project:

The banker's algorithm is a resource allocation and


deadlock avoidance algorithm that tests for safety
by simulating the allocation for predetermined
maximum possible amounts of all resources, then
makes an “s-state” check to test for possible
activities, before deciding whether allocation
should be allowed to continue
Skill developed / Learning out of
this Micro-Project:

Increase knowledge about Banker’s &


Safety algorithm for deadlock
detectionand avoidanceExperience
teamworkIncrease communication
skillKnow about Banker’s & Safety
algorithm for deadlock detection and
avoidance

You might also like