Assignment 4, Process Scheduling

  1. What is the difference between preemptive and nonpreemptive scheduling?

  2. Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:

    Processburst TimePriority
    P1 10 3
    P2 1 1
    P3 2 3
    P4 1 4
    P5 5 2

    For each of the scheduling algorithms, FCFS, Shortest-Job-First (SJF, nonpreemptive), Priority (smaller priority number implies higher scheduling priority), and RR (quantum = 1) do the following.

    1. Draw a Gantt chart to show how these processes would be scheduled.
    2. Give the turnaround time (total time from first arrival into ready state until cpu-burst is completed) of each process.
    3. Give the waiting time (total time spent in the Ready state) of each process.
    4. Give the average waiting time of all the processes.

    Which of these scheduling algorithms gives the smallest average waiting time?

  3. Suppose the following three processes arrive for execution at the arrival times indicated.

    ProcessArrival TimeBurst Time
    P1 0.0 8
    P2 0.4 4
    P3 1.0 1

    1. What is the average wait time for these three processes using the FCFS algorithm?
    2. What is the average wait time, using the non-preemptive SJF algorithm?
    3. What is the average wait time, using Shortest Remaining Time First (the preemptive version of SJF)?
    Note! You cannot schedule a process to execute before it has arrived!
  4. Of the scheduling algorithms, FCFS, SJF (non preemptive), SRTF (preemptive version of SJF), RR, and the class of Priorty algorithms, which ones cannot cause starvation? Briefly explain your answers.