COSC 3346, Operating Systems

Project #4: Implementation of Banker's Algorithm

Date Assigned: Monday, July 10, 2017
Due Date: Monday, July 17, 2017 by 11:59 p.m.

OBJECTIVE

The purpose of this programming project is to explore resource allocation algorithms.  This can be achieved by implementing the banker's algorithm as described in our textbook and discussed in class.

This project is worth 100 points.  20 extra points will be awarded if you correctly implement this project in some other programming language (Python, Java, R, FORTRAN, C# etc.)

 

PROJECT SPECIFICATIONS

Review the banker's algorithm discussed in class and on pages 330-336 from the book.  Your program must be named "banker" and will read the allocation, max, available, and request vectors from a file.  The name of the file will be passed to your program as a command line argument.  The input file format is the following:

Your program will output the following in a standardized format.

  1. Echo the number of processes.
  2. Echo the number of resource types.
  3. Echo the allocation matrix.  Label the processes and resource types (see sample output).
  4. Echo the max matrix.  Label the processes and resource types (see sample output).
  5. Compute and print the need matrix.  Label the processes and resource types (see sample output).
  6. Echo the available vector.  Label the resource types.
  7. Compute if the system is in a safe state.
  8. Echo the request vector.  Label the process making the request and resource types (see sample output).
  9. Compute if the request can be granted.
  10. Compute the new available vector (see sample output).

Here is a sample input file.

Here is how the program should be run.

% banker s1.txt

Here is the sample output.

Sample input is provided however you should test your program with different number of processes and resource types (i.e. different datasets). 

 

ASSESSMENT AND GRADING

This is an individual assignment.  Your program may be written in C or C++.  Comment and document all code submitted!  Use penguin.tamucc.edu for your program development and testing.  You may do development work on your personal machine but final submissions must compile without errors or warnings and execute without core dumping.  Your program will be tested using one of our departmental machines.  Your project must follow the documentation standards defined here.  Use good programming practices by implementing procedures and functions where necessary.  You may use the STL in your solution.

 

PROJECT SUBMISSION

Please see the project submission guidelines for details on how your project should be formatted for submission.