CS 3120 Operating Systems, Summer 2003

Assignment 2, due:  Monday, June 2, 1:35 pm.

 

This assignment is to be typed with the exception of any diagrams, which can be neatly drawn.

 

  1. [10 points] For the following set of processes, draw a Gant diagram representing the allocation of the CPU and calculate the average response time and average wait time using FCFS, SJF, SRT, and Round Robin (q = 3, q=7).  Show all calculations.

 

Process

Arrival Time

Total Burst Time

P1

0

12

P2

1

1

P3

2

5

P4

4

2

P5

5

7

P6

6

3

 

 

  1. [3 points] Given a full context switch time of 1 quantum, an average IO bound process burst time of 7, an average CPU bound process burst time of 100, and a mix of 70% IO bound processes and 30% CPU bound processes, what quantum length would you select for Round Robin scheduling if:
    1. You were trying to maximize CPU utilization
    2. Minimimize waiting times
    3. Minimize response time. 

 

Discuss your reasoning behind each answer.

 

  1. [1 point] When a process forks a child, the parent and child processes gain access to the CPU in an undetermined order.  This can lead to a race condition.  Was this a problem with Assignment 1?  Why or why not?

 

  1. [6 points] Examine Peterson's algorithm with the following modifications.  Determine if the algorithm is still correct or not.  If it's correct, prove it correct for mutual exclusion, bounded waiting, and progress.  If it's incorrect, demonstrate with a specific interleaving, what goes wrong:
    1. turn = j is changed to turn = i (I want in, you have to wait for me) for both processes
    2. the lines flag[i]= true and turn = j are reversed in both processes (it's your turn, I want in)
    3. flag[i]= true and turn = j are reversed in Pi (it's your turn, I want in), but the other process, Pj, is left with the order flag[j]=true and turn = i (I want in, it's your turn)