If you read the first line of the Wikipedia page for FreeRTOS, you will learn that it’s a real-time operating system for small embedded devices.
That’s true, as far as it goes — although if you are a software engineer coming to a small microprocessor from a more powerful computing device (which is to say, any other computing device at all), you might think that calling FreeRTOS an “operating system” is stretching the definition a bit. FreeRTOS is essentially just a thread scheduler plus a TCP/IP stack. It has no virtual memory, no file systems and no security model. You compile FreeRTOS’s kernel right into your application, which is then loaded onto your MCU.
And yet it’s far from a toy.
The first thing to know is that FreeRTOS is oddly named: The “RTOS” is the least interesting thing about it. Here are some more interesting points:
The Advantages of FreeRTOS
First, simplicity. There’s not much to FreeRTOS, and I mean this to be a high compliment. It’s only a small lie to describe the whole OS as nothing more than a scheduler for threads (which FreeRTOS calls “tasks”) plus a TCP/IP stack.
What is there is very well done. The kernel comprises only three files, and the whole thing is a beautiful haiku: Each line of code has been whittled down to its necessary essence, nothing more. As a result, there’s not that much that can go wrong. Also, all the .c files for the whole OS are right there in your development tree — so if you do need to spelunk into the kernel code to figure out a problem, it’s not that hard to wrap your head around.
Going hand in hand with the simplicity is FreeRTOS’s small size. Many tiny microprocessors have limited RAM and limited flash storage. FreeRTOS is tiny, which can lower your cost of goods considerably. When you’re working on these small MCUs, you get ecstatic when you can save a few bytes — space is always tight.
Next, FreeRTOS is ubiquitous. It runs on pretty much any small, modern MCU. That’s good when you’re bringing a product to market because it gives you a degree of hardware isolation. Building your code on top of FreeRTOS means it’s a little bit more portable, and this in turn means you’re a little bit less locked into whichever microprocessor vendor you have selected.
As the “Free” in the name suggests, FreeRTOS is fully open source. There’s some fear, uncertainty and doubt (FUD) about this, of course, because when have open-source advocates not argued? The backstory is that FreeRTOS was acquired by Amazon in 2017, and Amazon offers a great version of FreeRTOS in which they’ve made it easy to tie your small IoT device into AWS. However, the whole OS is openly available under the permissive MIT license. It’s hard for me to see a drawback to using FreeRTOS — even if you find yourself antagonistic toward Amazon for whatever reason.
Now, of course at the end of the list, yes, FreeRTOS is a real-time operating system. “Real-time” in operating system lingo means that the system designer can provide assurances that time-critical events will get serviced by the processor within tightly definable response times. FreeRTOS lends itself well to this application. Linux is wonderful, but it’s not an RTOS (despite various attempts over the years).
The thing is, as microprocessors have become more powerful, the number of applications that require “hard real-time” scheduling continues to shrink. These applications do still exist, but they’re getting rarer.
And that is why the “RTOS” is one of the least interesting things about FreeRTOS. Turns out, it’s a great choice for a whole class of small devices, even though most probably don’t need a real-time OS.