Q150: Priority Scheduling

Question #150: Priority Scheduling is an algorithm where scheduler assigns priority to the processes, and the highest priority process is the next one to get CPU attention. Priority scheduling can be preemptive (such that if a higher priority process enters the queue while a lower priority process is running, the lower priority process gets preempted) or it can be non-preemptive.

Which of the following is true?

Options:

  1. Starvation of a low priority process may occur if preemption is used but will not happen when processes are non-preemptive.
  2. Starvation of a low priority process may occur if non preemption is used but will not happen when processes are preemptive.
  3. If static priorities are assigned (meaning, once assigned, priority of a process will not be changed) then starvation can happen with or without preemption. Starvation can be avoided if priorities are dynamically adjusted.
  4. Priority scheduling will always suffer from starvation.

Solution: 3rd option is the correct one. Priority scheduling can prevent starvation by using aging which dynamically changes process’s priority.

Q126: Comparing process scheduling algorithms

Question #126: Which of the following is not true?

Options:

  1. Long jobs can be starved in SJF (Shortest Job First) algorithm.
  2. Prediction of future is required in SRTF (Shortest Remaining Time First) algorithm.
  3. High turnaround time for equal length jobs in RR (Round Robin) algorithm.
  4. If pre-emption is allowed for SJF, it will be better than SRTF.

Solution: The correct answer is the last one. If pre-emption is allowed for SJF, it will be same as SRTF.