Q158: Hardware support for scheduling

Question #159: In operating systems, scheduler is a piece of code that is used to switch the CPU between the processes or threads. Is there a need of any hardware support for scheduling in Operating systems?

  1.  No, there is no need. Everything can be done purely in software.
  2.  Yes, only an interrupt controller is needed.
  3.  Yes, an interrupt controller and a hardware timer is needed.
  4.  None of the above.

 

Solution:

The correct answer is the 3rd one. An interrupt controller and a hardware timer is needed such that the scheduler can be invoked after every timer interrupt. If there is no external interrupt, there is no way by which the scheduler runs other processes or threads in the system.

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.

Q60: Schedule tasks on servers

Question #60: There are a number of servers with a capacity limit and number of tasks of particular capacity to be scheduled on them. For the following example, answer whether the tasks can be schedules on the servers or not.

Server capacity limits: 8, 16, 8, 32

Tasks capacity needs: 18, 4, 8, 4, 6, 6, 8, 8

Options:

  1. Yes, all of the servers will hit their maximum capacity.
  2. No, they can’t be fulfilled.
  3. Yes, and there is more space in at least one of the servers.
  4. None of the above.

Solution: One of the possible scheduling is as follows:

18, 8, 6 => Server of capacity 32

8, 8 => Server of capacity 16

4, 4 => Server of capacity 8

6 => Server of capacity 8

And as can be seen, the correct answer is 3rd one as the server with capacity 8 is not completely exhausted in our given schedule.