Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:
Process | burst Time | Priority |
---|---|---|
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, non-preemptive), Priority (smaller priority number implies higher scheduling priority), and RR (quantum = 1) do the following.
Draw a Gantt chart to show how these processes would be scheduled.
Give the turnaround time (total time from the first arrival into ready state until CPU-burst is completed) of each process.
Give the waiting time (total time spent in the Ready state) of each process.
Give the average waiting time of all the processes.
Which of these scheduling algorithm gives the smallest average waiting time?
Answer: a. Gantt charts
(The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.) a. The four Gantt charts are _______________________________________________________ | P1 | P2| P3 |P4 | P5 | FCFS |_________________________|___|______|___|_____________| 0 10 11 13 14 19 _______________________________________________________ |P2| P4| P3 | P5 | P1 | SJF |__|___|______|_____________|__________________________| 0 1 2 4 9 19 There is a tie between the priorities of P1 and P3. If P1 is scheduled first: _______________________________________________________ |P2| P5 | P1 | P3 | P4| Priority13 |__|______________|_________________________|______|___| 0 1 6 16 18 19 or if for the tie between P1 and P3 priorities, P3 is scheduled first: _______________________________________________________ |P2| P5 | P3 | P1 | P4| Priority31 |__|______________|______|_________________________|___| 0 1 6 8 18 19 ____________________________________________________________________ |P1| P2| P3| P4| P5| P1| P3| P5| P1| P5| P1| P5| P1| P5| P1 |RR |__|___|___|___|___|___|___|___|___|___|___|___|___|___|____________| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 19
Answer: b. Turnaround Times
b. The turnaround time of each process for each of the scheduling algorithms in part a: Turnaround_time = Finish_time - Arrival_time FCFS SJF Priority1 Priority3 RR P1 10 19 16 18 19 P2 11 1 1 1 2 P3 13 4 18 8 7 P4 14 2 19 19 4 P5 19 9 6 6 14
Answer: c. Waiting Times
c. The waiting time of each process for each of the scheduling algorithms in part a: Waiting time (turnaround time minus burst time) = Finish_time - Arrival_time - Burst_time FCFS SJF Priority13 Priority31 RR P1 0 9 6 8 9 P2 10 0 0 0 1 P3 11 2 16 6 5 P4 13 1 18 18 3 P5 14 4 1 1 9
Answer: d. Smallest Average Waiting Time
d. The schedule in part that results in the minimal average waiting time (over all processes): FCFS SJF Priority1 Priority3 RR Ave. wait 9.6 3.2 8.2 6.6 5.4 So the answer is Shortest Job First.
Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:
Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time Priority P1 10 3 P2 1 1 P3 2 3 P4 1 4 P5 5 2 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF (SPN), a...
Consider the following set of processes, with the length of the CPU burst given in milliseconds:ProcessBurst TimePriorityP1 54P231P312P472P543The 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, nonpreemptive priority (a larger priority number implies a higher priority), and RR (quantum = 2). b. What is the turnaround time of each...
QUESTION 1 Consider the following set of processes, with the length of the CPU burst time given in milliseconds: Process Burst Time Priority P1 7 5 P2 2 4 P3 11 3 P4 9 1 P5 5 3 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, nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 2). b. What...
Consider the following set of processes, with the length of CPU burst in milliseconds. Process PI P2 P3 P4 P5 Arrival time 00 02 03 06 30 Burst time 10 12 14 16 05 Draw a Gantt chart that illustrates the execution of these processes using the preemptive shorte st job first (SJF) algorithm. Hence find the average waiting time. Draw a Gantt chart that illustrate the execution of these processes using preemptive priority scheduling algorithm. Given priority of each...
Consider the following set of processes, with the length of the CPU burst times given in milliseconds:a. Draw four Gantt charts illustrating the execution of the processes using FCFS, Preemptive SJF, a non-preemptive priority, and a RR (quantum=2) scheduling. (30 pts)Note: for the RR consider that the arriving time is 0 for all processesb. What is the average waiting time of each process for of the above scheduling algorithms? (10 pts)P1 8 2 0 P2 5 36P3 1 1 8...
Computer Science Help Instructions Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Burst Time Process P1 P2 Priority 10 4 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts illustrating the execution of these processes using FCFS, a nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum 1) scheduling. b. What is the...
8. Consider the following 5 processes in the ready queue: Process Burst Priority Arrival time n w P1 P2 w N P3 P P - W WE O P4 N P5 N A O Draw Gantt charts illustrating the execution of these processes for each of the following algorithms: (a) preemptive SJF, (b) RR (with quantum = 1), (C) FCFS, and (d) preemptive priority, and calculate the respective turnaround and waiting times.
Please answer the following question in C++ language Consider the following set of processes, with the length of the CPU burst time given in milliseconds: Process Burst Time Priority P1. 7 5 P2 2 4 P3 11 3 P4 9 1 P5 5 3 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, nonpreemptive...
Consider the following set of processes, with the length of the CPU burst given in milliseconds Assume a time slice of 10. Compute the average waiting time of each process for FIFO, SJF, and RR algorithms Process PO Pl P2 P3 P4 Burst Time 75 40 25 20 45 Arrival Time 0 10 10 80 85
4. Consider a ready queue with four processes :- Process Arrival Time Burst Time (ms) P1 Priority P2 P3 P4 P5 For each of the following CPU scheduling algorithms, determine the turnaround and average waiting time for each of the process :- a. Shortest remaining Time First b. Shortest Job First C. Priority Scheduling (Both pre-emptive and non-preemptive) d. Round Robin (quantum is 1 ms)