I would rather disagree: https://en.wikipedia.org/wiki/Computer_multitasking. OS in the most of the cases needs to be interactive, what would be impossible without multitasking. Multitasking would not be possible without a scheduler. So, we would not swap the active task and we would be stuck with the current task forever (or until it finishes), without even the ability to interrupt it.
One interesting thing this (dated but still very relevant) article misses is timer coalescing.
Most modern operating systems try to merge a bunch of timer actions into a single wake/interrupt. Not only does this leave more time for other work to be done in the normal case of a loaded CPU, but if there's less demand, it provides way more opportunity for the CPU to fall into a lower power state.
Some timer APIs will let you specify how accurate you want your timer to be. Often enough, a few tens or hundreds of milliseconds doesn't really matter for your use case, but that's AEONS in CPU time!
4 comments
[ 5.3 ms ] story [ 19.6 ms ] threadI would rather disagree: https://en.wikipedia.org/wiki/Computer_multitasking. OS in the most of the cases needs to be interactive, what would be impossible without multitasking. Multitasking would not be possible without a scheduler. So, we would not swap the active task and we would be stuck with the current task forever (or until it finishes), without even the ability to interrupt it.
There's no multitasking in this scenario. Think MS-DOS 6.22.
One process can have a preemptive multitasking. Even one process can make a very good use of a scheduler.
Most modern operating systems try to merge a bunch of timer actions into a single wake/interrupt. Not only does this leave more time for other work to be done in the normal case of a loaded CPU, but if there's less demand, it provides way more opportunity for the CPU to fall into a lower power state.
Some timer APIs will let you specify how accurate you want your timer to be. Often enough, a few tens or hundreds of milliseconds doesn't really matter for your use case, but that's AEONS in CPU time!