6,430 views

Which of the following statement(s) is/are correct in the context of $\text{CPU}$ scheduling?

1. Turnaround time includes waiting time
2. The goal is to only maximize $\text{CPU}$ utilization and minimize throughput
3. Round-robin policy can be used even when the $\text{CPU}$ time required by each of the processes is not known apriori
4. Implementing preemptive scheduling needs hardware support

(B) is false, why do you want to minimize throughput !
What about A? I think it is correct as external interrupts are required which can be provided by a clock
Yes rest all 3 are correct.

1. Turnaround time includes waiting time
• TRUE. $\text{Turnaround Time} = \text{Waiting Time} + \text{Burst Time}$
2. The goal is to only maximize CPU utilization and minimize throughput
• FALSE. CPU scheduling must aim to maximize CPU utilization as well as throughput. Throughput of CPU scheduling is defined as the number of processes completed in unit time. $\textsf{SJF}$ scheduling gives the highest throughput.
3. Round-robin policy can be used even when the CPU time required by each of the processes is not known apriori
• TRUE. Round-robin scheduling gives a fixed time quantum to each process and for this there is no requirement to know the CPU time of the process apriori (which is not the case say for shortest remaining time first).
4. Implementing preemptive scheduling needs hardware support
• TRUE. Preemptive scheduling needs hardware support to manage context switch which includes saving the execution state of the current process and then loading the next process.

Reference: Stanford Notes

by

edited
@Arjun , can you please confirm any context switching whether it is preemptive or non-preemptive needs hardware support?
edited by

@Arjun why context switch requires hardware support? I think the job of context switching is done by the dispatcher which itself is a part of OS.

I hate multiple select type questions very much.
Ans. A,C and D
A. turnaround time =completion time(burst+waiting)-arrival time.
B. The goal is to maximize throughput not to minimize it.
C. Round Robin is used in modern day systems as it doesn’t requires the information about the CPU time for processes rather it works just by providing same time quanta to every process.
D. Hardware support is essential for preemption.

Busy waiting
edited

Hardware support is required for preemptive scheduling.

Here, hardware support means generating periodic cycles that trigger an interrupt to the OS scheduler. The OS scheduler (or the dispatcher, same thing) checks whether enough time quanta has passed or not. If the time quanta of the current execution process is over, it triggers a context switch and brings another process from the $\texttt{READY QUEUE}$.

Without periodic interrupts from the hardware, there is no way of doing preemptive scheduling. An application can just keep executing without ever giving control back to the kernel.

In the case of non-preemptive scheduling, no interrupts are required as the application currently executes calls $\texttt{sched_yield()}$ when it is done with its operation.

The StackOverflow link people are posting talks about HOW the context switch is done, like who saves the context of the current process (register values, stack pointer, etc.). There are two ways of doing that: the hardware saves the context, or the OS does. Both are valid and can be selected based on what is required.

Correct