CIS 332
OS Concepts
Project 1b
Fall 2000 Vahid Moghaddasi
Due Date: TBA
DESCRIPTION
Deadlock can be defined as the permanent blocking of a set of processes
that either compete for system resources or communicate with each other.
In a multiprogramming and multi-user environment, resources have
to be shared among processes and that may lead to a deadlock. Operating
systems have different methods to prevent, detect or resolve any possible
deadlock situation. If a group of processes in a system may lead to a deadlock,
then that system is in an unsafe state.
You as a member of an OS designer group are asked to write a program
in a language of your choice* (see conditions)
that simulates a real system with a set of resources and processes
which are trying to finish their tasks. Your program will read all the
necessary information from a flat text file called cis332.dat and populates
all the elements of n x n matrices. The file "cis332.dat"
has the following format:
-
The following is an example of cis332.dat file (only bold font is
part of the file):
9 3 6
resource vector
3 2 2
Claim (Max) Matrix (in this case 3x4)
6 1 3
3 1 4
4 2 2
1 0 0
Allocation Matrix (in this case 3x4)
6 1 2
2 1 1
0 0 2
-
The above numbers are just an example, your program should work for any
set of Rs and Ps.
-
Rows are Processes and columns are Resources.
-
Your program should read the file upon startup and fill all the cells on
the matrices and vector(s).
-
Then, it should print the Available vector in one line e.g.:
0 1 1
-
And prints the Request (Need) Matrix:
2 2 2
0 0 1
1 0 3
4 2 0
-
At this point your program should analyze the system for any possible deadlock
and determine if the system is in a safe state or is going to deadlocked!
-
If the system is deadlocked, your program should print all the processes
which are involved in the deadlock.
-
Exit.
CONDITIONS
-
The program should be able to handle 5 x 5 matrices.
-
The program should run in text mode and on a UNIX system only.
-
The program should not ask the user for an input or output filename.
-
The program should terminate, without waiting for the user to press a key.
-
Languages, C, C++, Java and any of UNIX shell scripts including Perl could
be used.
HINTS
-
Write the program in a few different modules.
-
Write a small program just to read the file, to see if it works,
-
If it works in the above step, make it read and insert into the cells of
the matrices,
-
Then, read from the matrices,
-
At the end write the algorithm.
SUBMITTAL
-
Hard copy of your source file ( printed on paper ).
-
Three different hard copies of your data file (cis332.dat) along with the
output of sample runs.
-
Using my on-line upload utility, upload your source code ONLY.