Linux or an RTOS? How to tell when Linux is too much
Not every small device should run Linux. The right choice depends on what the device has to do and what it is built on.
Start with the chip
Standard Linux needs an MMU. Application-class cores such as Cortex-A have one; microcontroller cores such as Cortex-M usually do not. If your device is built on an MCU with a few hundred kilobytes of RAM, Linux is not an option and you are choosing between bare metal and an RTOS such as FreeRTOS or Zephyr.
Then think about timing
- Hard real-time — missing a deadline is a failure (motor control, safety functions). Use an RTOS or dedicated hardware.
- Soft real-time — occasional delays are tolerable (audio, dashboards). Linux, possibly with the PREEMPT_RT changes, can do this.
- No timing requirement — Linux is fine.
A common design uses both: a small MCU or RTOS handles the time-critical control, and a Linux board handles networking, storage and the user interface.
Compare what you get
| Bare metal / RTOS | Embedded Linux | |
|---|---|---|
| Typical hardware | Microcontrollers | Application-class SoCs |
| Boot time | Very fast | Slower; can be tuned |
| Resource use | Very small | Larger, with much more capability |
| Software ecosystem | Limited | Huge: networking, filesystems, languages, containers |
| Timing guarantees | Strong | Weaker unless specially configured |
| Development effort | Low-level, per-project | Reuse of existing software |
Rules of thumb
- Need a full network stack, TLS, a database, a web UI, containers or lots of existing software? Choose Linux and build it with Buildroot or Yocto.
- Need microsecond-level determinism or run on a coin-cell battery? Choose an RTOS or bare metal.
- Unsure? Prototype on a Linux board first; move the timing-critical part to an MCU only if measurements demand it.
See also how to choose a lightweight Linux once you have decided Linux is right.