LOGBOOK

HELP

1 / 18
Other keys: show • Space: good • 1-4: rate • 0: skip • 5: flag

Question

How do bare metal, embedded Linux and an RTOS compare as ways to program an IoT device?

Answer

Bare metal is one stand-alone program with no kernel. Embedded Linux gives a full OS with drivers and tools at the cost of size and power. An RTOS sits between them: a small real-time kernel that runs tasks concurrently with predictable timing.

Three ways to structure device software, from smallest and simplest to largest and richest.

* Three ways to structure device software, from smallest and simplest to largest and richest. *

Bare metal RTOS Embedded Linux
Kernel None; code runs stand-alone on the processor Small real-time kernel Full Linux kernel with kernel/user isolation
Concurrency Tasks run one at a time, driven by priority-based interrupts and timers Tasks run concurrently; preemption lets a higher-priority task interrupt a lower one Processes and threads, but scheduling is tuned for throughput, not deadlines
Synchronisation No tools; you build your own flags Semaphores, mutexes, queues Full set, plus IPC between processes
Footprint Smallest memory, lowest power and cost Kilobytes, plus optional file systems, protocol stacks, GUIs Larger footprint, more RAM, bigger SoC, more power
Ecosystem What you write yourself Drivers and stacks for the target chip Large driver library, mature IP stack, vast reusable source code, advanced compile and debug tools
Best for Ultra-low-power, single-purpose devices Devices that must respond within a defined short time Gateways and devices that need rich software

The deciding question is what the device has to guarantee. If it only reads a sensor every minute, bare metal is enough. If it must react to an event within a few milliseconds while also running Wi-Fi, an RTOS gives concurrency without giving up timing. If it needs a web server, a database and SSH, embedded Linux is worth the megabytes and the watts.

Tip: Linux is fair, an RTOS is predictable, bare metal is simple.

Go deeper:

or press any other key

Question

What is a real-time operating system, and what does "real-time" actually mean?

Answer

An RTOS manages the hardware of an embedded system with precise, predictable timing and high reliability. "Real-time" means every response is guaranteed within a known deadline, not that it is fast.

A general-purpose OS such as Windows or desktop Linux is designed to keep the whole machine busy and be fair to every program. It will usually respond quickly, but it makes no promise: a background update or a page fault can delay your code by an unpredictable amount.

An RTOS makes the opposite trade. It is intended to serve applications that process data as it comes in, and its key goal is that the timing is predictable: the worst-case time to respond to an event is known and bounded. The six properties it is built around are:

  1. Multi-tasking — several tasks share the processor.
  2. Small latency — the delay before a task gets the processor is bounded.
  3. Preemption — a more important task can interrupt a less important one.
  4. Predictability — you know how long tasks take.
  5. Determinism — the same inputs lead to the same timing, so deadlines can be proven.
  6. Responsiveness — inputs and events are handled within a defined short period.

A car's airbag controller is the classic example. Deploying in 15 ms every time is correct; deploying in 1 ms usually and 200 ms occasionally is a failure, even though its average is faster.

Tip: real-time = on time, every time. A late correct answer is a wrong answer.

Go deeper:

or press any other key