Due: Friday, April 11, 19:30
OFFICIAL VERSION
Banker's Algorithm:
1. Assume we have the following resources: tape drives,
graphic displays, printers and disks. Consider that we have already allocated
these resources among four processes as demonstrated by the following Allocation
matrix.
Also we have a MAX matrix to describe the
maximum resources each process needs. The available resources now
are : Available = (1, 0, 2, 0) for tape drives, graphic displays,
printers and disks, respectively.
Allocation matrix:
Process Name Tape Drives
Graphics Printers Disk
Drives
Process A
2
0
1
1
Process B
0
1
0
0
Process C
1
0
1
1
Process D
1
1
0
1
MAX matrix:
Process Name Tape
Drives Graphics Printers
Disk Drives
Process A
3
2
1
1
Process B
0
2
1
2
Process C
4
1
1
1
Process D
1
1
1
2
Questions:
a) How many total resources are available
of the types: tape
drives, graphic displays, printers and disks, respectively?
b) What are the contents of the "Need" matrix?
c) Is the system in a safe state? Why?
d) Suppose Process A were to deallocate its
resources and immediately terminate. Is the system in a safe state? Why?
e) Suppose further that Process B were to allocate one additional Disk. Is the system in a safe state? Why?
2. What are the major disadvantages of the Banker's Algorithm? (list at least three)
Deadlock:
3. Consider a system consisting of four resources of the same type
that are shared by three processes, each of which needs at most two resources.
Show that the system is deadlock free (no matter what the current
allocation state is).
File Systems:
4. What are the advantages and disadvantages of recording the name of the creating program with the file attributes (as is done in the older versions of the Macintosh operating system)?
5. Give an example of an application in which data should be accessed
in the following order:
a) Sequentially
b) Randomly
6. How much time did you spend on this assignment?