Scheduling Flashcards
(111 cards)
Scheduling
Policies that the OS employs to determine the execution order of ready processes/threads (& which core to execute on multicore systems)
⭐️ CPU utilization
Percentage of time CPU is busy executing jobs
⭐️ Throughput
The number of processes completed in a given amount of time
⭐️ Turnaround time
The time elapsed between the arrival and completion of a process
⭐️ Formula for turnaround time
T_t = T_c - T_a
⭐️ Waiting time
The time a process spends in the ready queue
⭐️ Response time
The time elapsed between the process’ arrival and its first output
⭐️ What two metrics does scheduling aim to maximize?
CPU utilization and throughput
⭐️ What three metrics does scheduling aim to minimize?
Turnaround time, waiting time and response time
What 5 assumptions for workloads do we make?
Each job runs for the same amount of time
All jobs arrive at the same time
All jobs only use the CPU
Run-time of each job is known
Once started, each jobs runs to completion (preemption)
What’s preemption?
The ability of the OS to stop/pause a currently scheduled task in favour of a higher priority task
⭐️ First In First Out (FIFO)
First Come, First Served (FCFS)
Policy: Jobs are executed in arrival time order
⭐️ Convoy effect
A scheduling phenomenon in which a number of jobs wait for one job to get off a core, causing overall device and CPU utilization to be suboptimal
⭐️ What does the First In First Out scheduling algorithm suffer from?
Convoy effect
⭐️ Shortest Job First (SJF)
Policy: The jobs with the shortest execution time are scheduled first
⭐️ If all jobs start simultaneously & know their execution times in prior, what is the optimal scheduling algorithm in terms of average waiting time?
SJF
⭐️ Shortest-Time-To-Complete-First (STCF)
Policy: Always switch to jobs with the shortest completion time
⭐️ What are the two non-preemptive scheduling algorithms?
FIFO and SJF
⭐️ What sort of scheduler is STCF?
Preemptive
⭐️ What is a possible negative consequence of STCF?
Starvation
⭐️ If all jobs know their execution times in prior, which scheduler is optimal in terms of minimizing average waiting time?
STCF
⭐️ Response time
T_firstrun - T_arrival
⭐️ Round-Robin (RR)
Policy: Each process executes for a time slice. Switches to another process regardless of whether it has completed its execution or not
⭐️ If the job in a Round-Robin scheduler hasn’t yet completed its execution, what happens?
The incomplete job is added to the tail of the ready FIFO queue