EEE 3132 Assignment 5
EEE 3132 Assignment 5
Assignment 5
Total Marks: 50
Instructions:
For each of the scheduling algorithms, FCFS, Shortest-Job-First (SJF, non preemptive),
Priority (smaller priority number implies higher scheduling priority), and RR (quantum =
1) do the following.
a. Draw a Gantt chart to show how these processes would be scheduled (4 marks)
b. Give the turnaround time (total time from first arrival into the ready state until
CPU-burst is completed) of each process. (2 marks)
c. Give the waiting time (total time spent in the Ready state) of each process. (2
marks)
d. Give the average waiting time of all the processes. (2 marks)
Which of these scheduling algorithms gives the smallest average waiting time?
12 Suppose the following three processes arrive for execution at the arrival times indicated.
Process Arrival Time Burst Time
P1 0.0 8
P2 0.4 4
P3 1.0 1
a. What is the average wait time for these three processes using the FCFS
algorithm? (3 marks)
b. What is the average wait time, using the non-preemptive SJF algorithm? (1 mark)
c. What is the average wait time, using Shortest Remaining Time First (the
preemptive version of SJF)? (1 mark)
13 Suppose that the following processes arrive for execution at the times indicated. Each process
will run for the amount of time listed. In answering the questions, use non-preemptive
scheduling, and base all decisions on the information you have at the time the decision must
be made.
a. What is the average turnaround time for these processes with the FCFS
scheduling algorithm? (1 mark)
b. What is the average turnaround time for these processes with the SJF
scheduling algorithm? (1 mark)
c. The SJF algorithm is supposed to improve performance, but notice that we
chose to run process P1 at time 0 because we did not know that two shorter
processes would arrive soon. Compute what the average turnaround time will
be if the CPU is left idle for the first 1 unit and then SJF scheduling is used.
Remember that processes P1 and P2 are waiting during this idle time, so their
waiting time may increase. This algorithm could be known as future-
knowledge scheduling. (3 marks)
14 Consider the following set of processes, with the length of the CPU burst time given in
milliseconds:
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
a. Draw four Gantt charts that illustrate the execution of these processes using
the following scheduling algorithms: FCFS, SJF, non-preemptive priority (a
larger priority number implies a higher priority), and RR (quantum = 2).
(4 marks)
b. What is the turnaround time of each process for each of the scheduling
algorithms in part a? (2 marks)
c. What is the waiting time of each process for each of these scheduling
algorithms? (2 marks)
d. Which of the algorithms results in the minimum average waiting time
(overall processes)? (2 marks)
15 The following processes are being scheduled using a preemptive, round-robin scheduling
algorithm.
Each process is assigned a numerical priority, with a higher number indicating a higher relative
priority. In addition to the processes listed above, the system also has an idle task (which consumes
no CPU resources and is identified as Pidle). This task has priority 0 and is scheduled whenever
the system has no other available processes to run. The length of a time quantum is 10 units. If a
process is preempted by a higher-priority process, the preempted process is placed at the end of
the queue.
a. Show the scheduling order of the processes using a Gantt chart. (2 marks)
b. What is the turnaround time for each process? (3 marks)
c. What is the waiting time for each process? (3 marks)
d. What is the CPU utilization rate? (2 marks)
Submission Guidelines:
• Submit your assignment in any of the formats, handwritten, (PDF, or Word for blended
students)
• Include your name, student ID, and course code on the first page.
Good luck!