7 Tips for Optimizing an RTOS: Page 2 of 2

Real-time operating systems are finding their way into more and more systems. Developers who are accustomed to bare-metal development or working with highly resource constrained system will often complain about system performance or memory usage.

Memory usage can be minimized by limiting the number of RTOS objects that are created during run-time.

6. Optimize the Task Stacks

Task stacks are notorious for consuming the most memory in an application. Many developers just guess at a value rather than making a measurement. Many RTOSes will recommend a default stack size around 1 kB for a task. Is that too much? Too little? There is no way to tell without making a measurement so a developer will just guess. The result is way too much memory being allocated for stack space and wasted. Developers should utilize stack monitoring features associated with the RTOS to determine their min, max, and average stack usage. From the maximum, adding an extra 25% would be a safe rule of thumb to size the stack.

7. Turn Off Unused Features

RTOSes are extremely rich and complicated software systems. They include many features that won’t be utilized by every application or developer. Becoming familiar with the RTOSes configuration file can be very helpful in minimizing memory usage and code size. The configuration file allows developers to enable and disable features.


Using an RTOS doesn’t necessarily require a souped-up microcontroller or a plethora of memory. The way that a developer architects and uses their RTOS can make all the difference between whether it works well in a resource-constrained environment or is labeled bloat code. These seven tips are just a few to get you started in optimizing your RTOS.

What other tips can you think of to make sure that an RTOS runs efficiently in a small memory footprint? Share your ideas in the below comments section.


ESC, Embedded Systems Conference, BostonThe questions is no longer "should I use an RTOS," but "how can I most effectively design a system using an RTOS." Technical session From Baremetal to Real-Time Operating Systems , held during ESC Boston 2017 , May 3-4, will answer this question and more. Register today!


Jacob Beningo is an embedded software consultant who currently works with clients in more than a dozen countries to dramatically transform their businesses by improving product quality, cost and time to market. He has published more than 200 articles on embedded software development techniques, is a sought-after speaker and technical trainer and holds three degrees which include a Masters of Engineering from the University of Michigan. Feel free to contact him at [email protected], at his website www.beningo.com/, and sign-up for his monthly Embedded Bytes Newsletter .



I did real time programming of PDP-8s back in the 70s. One application performed LORAN signal processing and navigation with 8K of 12 bit memory. Another used RTS-8 and DECNET-8 with modifications to implement a data concentrator acquiring production data through 20 serial data links for transfer to an IBM 1800. Serial data was from PDP-8s operating production machinery. These could be downloaded from the concentrator. All programming was assembly code and fit into 48Kbyte PDP8s.

Add new comment

By submitting this form, you accept the Mollom privacy policy.