Skip to content

kelvinkellner/Bankers-Algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

cee8e33 · Aug 3, 2021

History

88 Commits
Jul 31, 2021
Jul 31, 2021
Aug 3, 2021
Jul 31, 2021
Jul 25, 2021
Aug 3, 2021
Jul 31, 2021

Repository files navigation

Bankers-Algorithm

CP386 Assignment 4

Description

Banker's algorithm is a resource allocation and deadlock avoidance method that simulates allocation for predefined maximum feasible quantities of all resources in order to test for safety.

Installation

--> C Programming Language
--> GCC Complier for C
--> Windows Subsystem for Linux

Compile the program using GCC. When running, pass a list of space-delimited integers as arguments. The value of the number represents the number of available resources of that type of resource. Edit sample4_in.txt to change the customers. Each line in the file represents a thread, and the comma-delimited values represent the amount of each type of resource that the thread needs.

To compile and run:
screenshot of compiling and running the program

Features / Commands

  • Request resources:
    Requests an allocation of resources to a thread/customer, succeeds if resources are currently available and system remains safe after processing request, fails otherwise.
    screenshot of requesting resources successfully
    screenshot of request for resources failing

  • Release resources:
    Releases resources currently being used by a thread/customer and makes them available again, fails if thread has not been allocated those resources.
    screenshot of releasing resources successfully
    screenshot of request to release resources failing

  • Status:
    Displays the status of the system including available resources, and maximum, allocated, and needed resources for each thread/customer.
    screenshot of displaying status of the system

  • Run:
    Determines if there is a safe sequence for the threads/customers and executes the sequence if possible.
    screenshot of running the processes

  • Exit:
    Terminates the program.
    screenshot of exiting the program

Individual Contribution

Function-Wise

Function Kelvin Nish
main X
run_program X X
load_available_resoures X
load_customer_resources X X
display_status X
request_resources X X
release_resources X X
run_resources X X
is_safe X X
handle_request X X

Test cases

See an example test case here.

Contributors

--> Kelvin Kellner
--> Nishant Tewari

Credits

--> GeeksforGeeks - Banker’s Algorithm in Operating System

Project License

This project is licensed under the MIT License which is located here.

About

CP386 Assignment 4 with a partner.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published