This preview shows page 1. Sign up to view the full content.
Unformatted text preview: CS-418 Operating Systems Professor: Van Horn Homework 4 Write a Simulator (in C++ or Java) that implements the Banker's Algorithm The Banker will read two files, resources.txt and processes.txt. (Note: be sure to use these exact filenames and assume that these files are in the current directory). The resources.txt file contains 3 lines. Each line contains a resource name, followed by a space, followed by the number of resources of that type. For example, the resources.txt file might look like this:
A B C 10 5 7 The processes.txt file contains 6 lines. Each line contains a process name, followed by triplets of (1) a resource name, (2) the number of that resource allocated, and (3) the maximum number that may be requested. All fields are separated by a space. For example, the processes.txt file might look like this:
P1 A 4 7 B P2 A 3 5 B //. . . (3 P6 A 1 8 B 0 0 C 1 2 2 3 C 2 4 more lines) 1 2 C 3 4 . Your job is to read the files and implement the Banker's Algorithm to determine if the system is in a safe or unsafe state. If the system is safe, your program should output the safe order of execution of the processes. If the system is unsafe, output the message "Unsafe." Deliverables: Deliver to the Blackboard Digital Dropbox your source code and a report that explains your program design. ...
View Full Document
This note was uploaded on 02/21/2012 for the course COMPUTER cs 418 taught by Professor Idk during the Spring '12 term at Capitol College.
- Spring '12
- Operating Systems