Assignments for cs-308-operating systems

CS-308 - Operating Systems - Assignments

Assignment 1

1. Consider the following jobs:
Job # Arrival time Run time
A 0 5C, 3I, 4C, 5I, 3C
B 2 3C, 6I, 4C
C 6 4C, 3I, 7C
C stands for CPU (or computational) and I for I/O

a) Using the FCFS method, compute the completion time of each job above.

Note that you can get the completion time from the Gantt chart.

b) Using the results you found in a) compute the turnaround time for each job, the weighted turnaround time of A, and the CPU utilization.

CPU utilization means just that: How much of the time the CPU was utilized vs idle. Should be a percentage from 0 to 100.

Turnaround time is the time from start (arrival time) to finish (including I/O time).

Weighted turnaround time = Turnaround time / run time where run time is similar to burst time (as if the job ran by itself).

2. Consider the following jobs:
Job # Arrival time Run time
A 0 5
B 2 5
C 3 4
D 6 2

a) Using the SJF method, compute the completion times of the above jobs and the average waiting time.

b) Using the SRTF (Shortest Remaining Time first) method, compute the the completion times of the above jobs and the average waiting time.

Note that SRTF is SJF with preemption.

Completion time - arrival time = turnaround time

c) Using the Round Robin method (with time slice = 2 units), compute the completion times of the above jobs and the average waiting time.

3. Assuming that Job A has low priority, Job B has medium priority, and Jobs C & D have high priorities,

a) using the non-preemptive priority algorithm, compute the completion times of each of the jobs in 2 and the average waiting time.

b) using the preemptive priority algorithm now, compute the completion times of each of the jobs in 2 and the average waiting time.

4. Write a paragraph about the life of a process using role playing as was done in class. You may describe a totally new situation (recommended) or one that we discussed already describing the various roles involved.

See Doan's solution

Assig. 2

Assignment 2

Deadlock problems

1. There is a total of 11 units of a resource and the system is currently in the following state:
Process Max Allocation
P0 6 3
P1 5 3
P2 7 1
P3 8 2
a). Show that the above state is a safe state. You must come up with a complete sequence of jobs.

b)If the system is in the state S0 above, should a request of 1 unit by P1 be granted? You must give a sequence.

c)If the system is in state S0, should a request of 1 unit by P2 be granted? You must give a sequence.

2. There is a total of 15 units of R1 (resource 1) and 7 units of R2 and the system is in the following state (again call it S0):
Process Max Allocation
R1 R2 R1 R2
P0 4 | 2 2 2
P1 5 | 7 4 1
P2 4 | 6 3 1
P3 6 | 4 3 2
a).Show that the above state is a safe state. You must come up with a complete sequance of jobs.

b). If the system is in state S0, should a request of (2,0) units by P2 be granted? You must give a sequence.

c). If the system is in state S0, should a request of (0,2) units by P2 be granted? You must give a sequence.

d). If the system is in state S0, should a request of (2,0) units by P3 be granted? You must give a sequence.

e). If the system is in state S0, should a request of (1,1) units by P2 be granted? You must give a sequence.

Assignment 3

Write a short report on each of the students presentations.

More later...

Last updated 3/23/98