Lecture 13: Scheduling overview and MLFQ Flashcards

1
Q

What is a scheduler responsible for

A

A scheduler is responsible for deciding which process runs and for how long

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Examples of impractical schedulers

A

FIFO: run in order of arrival. When a long process happens to arrive first, it can stall the execution of other processes

Shortest Job First: Selects a process that will run the shortest. However, we don’t know how long a process will run ahead of time

Shortest Time-to-Completion First: preempt running process if another process has a shorter time to completion. However, long-running processes will be starved if short-running processes keep arriving.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Metrics used to measure how good a scheduler is

A

Turnaround time: time of completion - time of arrival: Poor turnaround is bad for CPU-bound processes

Response time: time to first run - time of arrival. Poor response time will feel laggy to users

Throughput: Number of processes completed per unit time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Round-Robin (RR) scheduling

A

Round-Robin (RR) scheduling: instead of running a process to completion, run a process for a time slice, preempt the process, and context switch to the next process in the run queue; Do this repeatedly.

The time interrupt handler checks how long the current process has been running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What should the scheduler do when a process is waiting for I/O?

A

Run another process instead! It would be inefficient to have the process spin while waiting for I/O.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

CPU bound vs I/O bound

A

CPU bound: when they run, they use CPU continuously. ex, ML models, simulations, and so on.

I/O bound: when they run, they spend most of the time waiting for I/O. Ex, text editors, and so on.

Processes can switch btn the two obviously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Multi-level Feedback Queues (MLFQ) scheduling algorithm

A

Round-Robin (RR) is good for response time but bad for turnaround time.

On the other hand,

MLFQ scheduling algorithm optimizes turnaround time and minimizes response time.

Rule 1) Processes with higher priority are run first
Rule 2) processes with equal priority are run RR.
Rule 3) When a process enters the system, it’s given the highest priority (top of the queue)
Rule 4) If a process uses up the allocated time slice, it’s moved one down in the queue
Rule 5) After some period of time, move all the jobs in the system to the topmost queue (now processes have a way to get back up the queue)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly