CS 620

Assignment 6

(Total 50 points)

Due Date: 04/17/2008 (Thursday)

The assignment is to be handed in class. No late assignments will be accepted.

1.(15 points)

An operating system uses multi-level feedback (with preemption) for CPU scheduling. There are 3 feedback queues with associated quanta 1, 2, and 3 time units.

Consider the following workload:

Process

Arrival Time

CPU Requirements

p1

1

6

p2

3

8

p3

6

4

p4

9

3

p5

11

5

 

[a.] Calculate the mean response time, observing from time 1 until all processes have completed.

[b.] Suppose that non-preemptive multi-level feedback was used instead. Calculate the mean response time, observing from time 1 until all processes have completed.

[c.] Calculate the mean response time of jobs when Round Robin is the CPU scheduling policy with time quantum = 2.

[d.] Calculate the mean response time of jobs when SRTN is used as the scheduling policy.

[e.] Calculate the mean response time of jobs when LIFO is used as the scheduling policy.

---------------

2. (5 points )

Many CPU scheduling algorithms are parameterized. For example, the RR algorithm requires a parameter to indicate the time slice. Multilevel feedback queues require parameters to define the number of queues, the scheduling algorithms for each queue, the criteria used to move processes between queues, and so on.

The algorithms are thus really sets of algorithms (for example, the set of RR algorithms for all time slices, and so on). One set of algorithms may include another (for example, the FCFS algorithm is the RR algorithm with an infinite time quantum). What (if any) relation holds between the following pairs of sets of algorithms?
a. Priority and SJF
b. Multilevel feedback queues and FCFS
c. Priority and FCFS
d. RR and SJF
e. LCFS preemptive and SRTN

---------------

3. (8 points)

Which of the following scheduling algorithms could result in starvation? Give a brief explanation in each case.
a. First come first served (FCFS)
b. Shortest job first (SJF)
c. MultiLevel Feedback (MLF)
d. Last come first served (LCFS)
---------------

4 (5 points)

  #include <sys/types.h>
  #include <stdio.h>
  #include <unistd.h>

  int a = 8;
  int b = 2;
 
  int main(){
     pid_t pid;

     if ((pid = fork()) == 0){ /*child process */
       a += 3;
       b = a + 4;
     }
     else if( pid>0 ){ /*parent process*/
       a += 4;
       b += a;
       printf("Parent: a = %d, b= %d,", a, b); /* LINE A */
       exit(0);
     }
  }

In the above program, what will be the output at LINE A? Explain your answer.


---------------

5. (6 points)

Distinguish between:
a. (2 points) creating a thread versus creating a process.
b. (2 points) user-level threads versus kernel-level threads in terms of how they are scheduled.
c. (2 points) invoking an ordinary procedure versus invoking a thread create procedure.
Your answer should address the internal operating system actions.

---------------

6. (4 points)

Throughput, response time and fairness are the common performance metrics used to evaluate a scheduling algorithm.

a. What is the relationship between throughput and response time?
b. What is the relationship between fairness and response time?

---------------

7. (3 points)

Consider a variant of the RR scheduling algorithm where the entries in the ready queue are pointers to the PCBs.

a. What would be the effect of putting two pointers to the same process in the ready queue?
b. What would be the major advantages and disadvantages of this scheme?
c. How would you modify the basic RR algorithm to achieve the same effect without duplicate pointers?

8. (4 points)

Consider the following preemptive priority-scheduling algorithm based on dynamically changing priorities. Larger priority numbers imply higher priority. when a process is waiting for the CPU (in the ready queue, but not running), its priority changes at a rate a; when it is running, its priority changes at a rate b. All processes are given a priority of 0 when they enter the ready queue. the parameters a and b can be set to given many different scheduling algorithms.

a. what is the algorithm that result from b > a > 0?
b. what is the algorithm that result from a < b < 0?


****************************************************************************************************
Return to the CS 620 Home Page