1
votes

In C, supposing that each algorithm was given the exact same set of processes, would the turnaround time be equal between first come first serve, shortest job first, and round robin? Or would it differ between scheduling algorithms?

3

3 Answers

2
votes

Generally, First Come First Serve (FCFS) and Shortest Job First (SJF) are implemented to favor turnaround time while Round Robin (RR) is implemented to favor the response time. It is usually a trade off. This means given the same processes (also depending on the type of workload), SJF and FCFS would generally have better turnaround time than RR and vice versa, RR would generally have a better response time than both.

To understand this better, you can read http://pages.cs.wisc.edu/~remzi/OSTEP/cpu-sched.pdf

2
votes

SJF has the best average turnaround time, followed by FCFS. RR has the worst turnaround time, in comparison.

Explanation:

FCFS scheduling is the simplest scheduling algorithm, but it can cause short processes to wait for very long processes (convoy effect).

SJF scheduling is an improvement over FCFS, taking into account the length of time a process needs to complete (CPU burst). SJF is provably optimal, providing the shortest average waiting time. Implementing SJF scheduling is difficult, however, because predicting the length of the next CPU burst is difficult. Furthermore, processes that have long running times may starve under SJF, if there are too many short ones.

RR offers a solution to the fairness issue, providing better average response time. That typically comes at the cost of a higher average turnaround time though.

At the end of the day, it is a tradeoff between average turnaround time and fairness in terms of response time.

Here is another link to help you out: https://homes.cs.washington.edu/~arvind/cs422/lectureNotes/sched-6.pdf

Alternatively, you could check out Chapter 6 CPU Scheduling of the following book:

Operating System Concepts, 9th Edition by Silberschatz, Galvin, and Gagne

0
votes

In comparison with respect to the average turnaround and average waiting times SJF < FCFS < RR. RR is implemented to avoid starvation of process which we we encounter in FCFS and SJF.