Intro to Scheduling
high level scheduling policies os implements
Assumptions
- each job runs for the same amount of time
- all jobs arrive at the same time
- once started, each job runs to completion
- all jobs only use the cpu, no i/o
- the run time of each job is known
these sound unrealistic, and we will shed them one by one
metrics
- turnaround time: a performance metric
- since all jobs arrive together ⇒
- fairness → Jain’s Fairness Index1 (jainwin baat)
- response time
First In, First Out (FIFO)
convoy effect: relatively-short potential customers get held up by a heavyweight customer
Shortest Job First (SJF)
greedy behavious → optimal with assumption 2
non-preemptive: job must run to end
Shortest Time-to-Completion First
relax assumption 3 (tasks need to run to completion)
also called “preemptive shortest job first”
Round Robin
the earlier algs do not consider response time, i.e. the user should get a response from the process they run asap
RR runs a job for a time slice until all jobs are finished
pretty (very) bad for turnaround time though
turnaround vs response time fight
Incorporating i/o
relax assumption 4 (no i/o)
basically just PSJF → choose the shortest job at any given time
- do A
- A is busy
- switch to B
- A is free again
- switch to A
we’ve dealt with all the assumptions except the last → you never actually know the run time of a process