Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Banker's Algorithm – Deadlock Avoidance

Author: Simran Gautam
Course: Operating Systems – Programming Assignment #2
Language: C++ (Linux/Ubuntu)


1. Overview

This project implements the Banker’s Algorithm for deadlock avoidance.

The program reads a snapshot of the system state from a text file (input.txt), builds the Allocation, Max, Need, and Available data structures, and then runs the Banker's safety check to decide whether the system is in a safe state.

  • If the system is safe, the program prints a safe sequence of processes.
  • If it is not safe, it clearly reports that the system is not in a safe state.

For the sample data based on the assignment’s table, the system is safe, and one safe sequence produced by this program is:

P3 -> P1 -> P0 -> P2 -> P4


2. Input File Format (input.txt)

The program expects input.txt to be in the following custom format:

  1. First line

    number_of_processes  number_of_resource_types
    
    
  2. Next nProc lines – Allocation matrix Row i = resources currently allocated to process Pi.

3.Next nProc lines – Max matrix Row i = maximum demand of process Pi.

4.Last line – Available vector Remaining available units of each resource type.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages