Policy |
Preemptive? |
Basic Idea |
Starvation? |
Advantages |
Disadvantages |
Used? |
Optimal |
No |
Given a set of processes, known running times, a known objective function,
and lots of time to do math, it is easy to compute the optimal schedule. |
In this scheme there are a finite number of processes. The question
makes little sense. |
Perfect schedule |
Takes O(n*n) time, and the preconditions are rarely true. |
Not really |
First Come First Serve |
No |
Put the tasks in order by arival time. Run them in that order.
This is the model the cashier uses at McDonalds |
Nope. Unless someone has an infinite loop, whcih is unfair. |
Easy to understand. It's fair in some sense. |
Makes little attempt to optimize the objectives above. |
Windows 95 MacOS |
Shortest Job Next |
No |
Learn the time requirements of all the processes. Pick the smallest. |
Yep |
Optimal wait-times given non-preemption |
Got to learn the requirements somehow. |
? |
Shortest Job Next with Preemption |
Duh |
Learn the time requirements of all the processes. Pick the smallest.
If a new process comes in the middle of an existsing one, recompute the
times anyway. |
Yep |
Optimal wait-times |
Optimal wait-times |
? |
Priority |
If a new process arrives, but not otherwise. |
Rank all the processes by arbitrary priority. Run the highest
priority. |
Probably, but it depends on how you assign priority. Aging prevents
this. |
Does what you want when you want it. |
You need some scheme to assign priority |
? |
Shortest Deadline Next |
If a new process arrives, but not otherwise. |
Run the process who's deadline to finish is next |
Yep, but all real time OS's have starvation |
If the deadlines can be met, this is guarenteed to do it. |
Someone has to tell the scheduler the deadlines. But if you're
doing a real time OS, you need to do that anyway |
Most real time OS's |
Round Robin |
Yes |
Do them for a short while. Then do them again. Repeat. |
No |
Feels fair to most people. Easy to do. |
Does not win in most benchmarks of real world tasks. |
Sort of where people start, and then they add modifications to make a real scheduler. |