Skip to content

jacobcabral/cp-386-a4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7ac51cc · Apr 5, 2022

History

8 Commits
Apr 5, 2022
Mar 15, 2022
Apr 5, 2022

Repository files navigation

Project Title: CP 386: Assignment 4 - Winter 2022

About Developers:

  • This project was developed by Jacob Cabral and Christopher Rossi. We are both in our third year of our computer science major at Wilfrid Laurier University (date is currently April 2022). In addition, we both like to play videogames and place squares on reddit r/place as a fun pass time.

Makefile:

  • It is a set of commands with variable names and targets to create an object file and to remove them. However, in this project, we did not make use of a makefile and just used the sample4_in text file as our input.

Test Cases:

  • For our program, We did not use any test cases, just used the sample4_in text file as our testing

Sample Input:

image

Question 1 Banker's Algorithm:

  • We have made a multi-threaded program that implements the banker's algorithm. Customers request and release resources from the bank. The banker will keep track of the resources. The banker will grant a request if it satisfies the safety algorithm. If a request does not leave the system in a safe state, the banker will deny it.

Q1 Features:

  • For question 1, we used the following data structures as mentioned in chapter 8 of the text book:
    • Available amount of each resource
    • Maximum demand of each customer
    • Amount currently allocated to each customer
    • Remaining need of each customer
  • Safety algorithm to grant a request, if it leaves the system in a safe state, otherwise destroy it
  • Allows the user to interactively enter a request for resources or to output the values of the different data structures (available, maximum, allocation, and need) used with the banker's algorithm and executes customers as threads in a safe sequence.

Expected output for Q1:

image image

Question 2: Best-Fit Algorithm (we did not complete Q2)

  • In this program, you would be using Best-Fit algorithm for contiguous memory allocation (refer to section 9.2 from text). This project will involve managing a contiguous region of memory of size MAX where addresses may range from 0 ... MAX − 1.

Q2 Features:

  • Your program must respond to three different requests:
    • Request for a contiguous block of memory
    • Release of a contiguous block of memory
    • Report the regions of free and allocated memory
  • Your program will allocate memory using Best-Fit algorithm. This will require that your program keep track of the different allocations and holes representing available memory

Expected output for Q2:

image

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages