RTOS Costs
Nothing in life is free. While an RTOS provides many benefits, it does introduce some costs as well, including the following:
1. License fees
Commercial RTOS products have a license fee. Open source RTOSes do not. However, the quality, performance, documentation, and support of commercial RTOSes is much better, which results in enhanced application development. This enhanced development can easily offset the license cost. In addition, many commercial RTOSes have been functional safety certified, which is a benefit even for applications that don’t yet require function safety certification.
2. Memory Overhead
Good RTOSes generally require less than a few kilobytes of memory for minimal usage. However, for some very resource constrained devices (< 3KB RAM), this can be prohibitive.
3. Processing Overhead
Context-switching and API call overhead is typically less than a few microseconds on most good RTOSes and usually isn’t noticeable. In some situations, a good RTOS will actually reduce overhead in comparison with a non-RTOS implementation. This is because the “super loop” implementations inherently has to poll for work to be done. As the application becomes more complex, this additional polling can result in more overhead than an RTOS. The “super loop” polling also grows as the application code grows, while the RTOS processing overhead is constant.
4. Complexity
An RTOS introduces the complexity of multithreading, but this too could be less complex than a non-RTOS, “super loop” implementation as the application complexity increases. The important takeaway here is that the RTOS complexity is a constant, where the “super loop” complexity continues to grow as functionality is added.
RTOS Summary
An RTOS might not be appropriate for every embedded application. However, an RTOS will be the right choice for a large majority of the 7 billion devices that will be shipping annually by 2025.