Deciding who goes first
One seat, many waiting. The calling order changes the wait.
Who gets called first
There is one counter but several people waiting.
Since only one can be called at a time, you have to decide who goes first. The one who arrived first? The one whose errand finishes fast? The urgent one?
Deciding this calling order is scheduling. Tasks line up in front of a CPU too, and someone has to decide which one is handled first.
One seat, many waiting. You decide the calling order.
Scheduling is deciding which of the waiting tasks gets handled first.
Change the order, change the wait
There are the same three guests. One has a long task, two have short ones.
The top row calls them in arrival order. If the long one is first, the two short ones behind it wait a long while until it finishes. The bottom row calls the short ones first. The two short ones finish quickly, leaving just the long one.
Same guests, same tasks, yet changing only the order changed the average time everyone waited.
Even the same three wait differently depending on the calling order.
Even with the same amount of work, changing the order changes the average wait.
Set the order yourself
Four guests are waiting. Each has a task of a different length.
As you change who gets called first, the average time everyone waited shows up right below.
Put short tasks up front and the average drops. Put long ones up front and it rises. Try moving them around and find which order shrinks the average the most.
Reorder them and watch how the average wait changes.
Putting short tasks first lowers the average wait, but that is not always the right call.
Faster is not always better
If you always call short tasks first, the average drops. But a guest with a very long task can keep getting pushed back and wait forever.
So there is another way. Instead of giving it all to one, you give everyone a little turn, back and forth. No one gets stuck at the end forever.
The catch is that switching often costs time to change seats. Choose speed or choose fairness, but there is no free choice.
Short-first is fast, but a long task can keep getting pushed back.
The speed that lowers the average and the fairness where no one is stuck are traded against each other.
Put it on one page
Just remember three things.
First, scheduling is deciding the calling order, because there is one seat and many waiting tasks.
Second, changing the order changes the average wait. Putting short tasks first lowers the average. Third, even so there is no single right answer. Speed and fairness trade against each other, and switching often costs time too.
Order changes the average, and speed trades against fairness.