How does Linux implement multitasking on CPUs which do not support multitasking?

Someone told me that Linux can run on CPUs which do not support multiple tasks.

But if you have one core only which doesn’t support multitasking, how does Linux implement multitasking?

Let’s say I want to run two programs which need 1h to terminate each. How does Linux pause the first program after ~100ms to switch to the second program?

Here are 2 scenarios I can think of:

  • It’s not possible to run multiple tasks at once.
  • Linux uses a hardware timer to interrupt running processes.
Asked By: zomega


It’s not clear to me what you mean by a CPU that supports multiple tasks. I guess you’re thinking of multi-core CPUs, but they aren’t a pre-requisite for multitasking; multitasking operating systems pre-date multiple-CPU systems (let alone multi-core CPUs).

However as far as pausing a process to run another is concerned, Linux uses a variety of techniques, including hardware timers (indirectly). Essentially, any time the kernel is invoked, it can decide to change the running process. See the following posts for details:

Answered By: Stephen Kitt
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.