Simplifying Concepts.
Accelerating Innovation.

Jacob's Blog

Jacob Beningo
EPISODE #029

EPISODE #029 – How to Write Fast RTOS Code

Jacob Beningo talks with RTOS pioneer Bill Lamie, creator of Nucleus, ThreadX, and PX5 RTOS, about how to write efficient, high-performance real-time code. They cover POSIX pthreads, keeping software simple, RTOS benchmarking, test-driven development, using AI as a development teammate, and practical tips for structuring RTOS applications.

Want to watch this episode instead? Check it out on our YouTube channel here!

For more Embedded Frontier Episodes, click here . . .

Takeaways

  • Keep it simple: complexity is the biggest enemy of embedded software, and a complex solution is probably not the right one.
  • Minimize nested function calls in critical paths, since pushing and popping registers and return addresses is expensive.
  • Design for performance from the start. Every comparison and data reference matters in the real-time path, and performance can’t be bolted on at the end.
  • Use an error-checking veneer selectively. Enable it for new or untrusted code and call the direct API for proven code to save cycles.
  • Standardizing on the POSIX pthreads API makes it easier to share code between Linux and RTOS-based products and to move between RTOSes.
  • Write documentation before code to keep your design flexible and expose interfaces that are hard to explain.
  • Adopt test-driven development by writing test cases before the code. This keeps you from writing unreachable paths and makes coverage targets such as 100% statement and branch coverage achievable.
  • Treat AI as a teammate, not a replacement. It excels at tedious tasks like proofreading, QA, concurrency review, and quick hardware lookups, but it isn’t reliable for pure code generation.
  • Put as many threads as possible at the same priority and use higher priorities only when preemption is absolutely necessary.
  • Use a minimalist number of threads and system objects to reduce accidental RTOS overhead.

Chapters

  • 00:00 Introduction and Bill Lamie’s RTOS Background
  • 03:00 State of the RTOS Industry and POSIX Standardization
  • 05:40 Design Lessons: Simplicity and Performance Techniques
  • 09:46 RTOS Benchmark Reports and Industry Competition
  • 14:30 Trade-offs: Complexity, API Overhead, Safety, and Documentation
  • 18:26 Test-Driven Development and 100% Coverage
  • 22:02 Using AI as a Development Teammate
  • 26:25 RTOS Application Best Practices: Priorities and System Objects
  • 29:03 Final Thoughts: Tool Complexity and Semiconductor SDKs

Links

Keywords

RTOS, real-time operating system, PX5 RTOS, ThreadX, Nucleus, Bill Lamie, POSIX pthreads, embedded systems, embedded software, RTOS benchmarking, RTOS performance, test-driven development, functional safety, AI in embedded development, Claude, Zephyr, FreeRTOS, thread priorities, embedded Linux, kernel optimization, software complexity

* * *

Struggling to keep your development skills up to date or facing outdated processes that slow down your team, raise costs, and impact product quality?

Here are 4 ways I can help you:

  • Embedded Software Academy: Enhance your skills, streamline your processes, and elevate your architecture. Join my academy for on-demand, hands-on workshops and cutting-edge development resources designed to transform your career and keep you ahead of the curve.
  • Consulting Services: Get personalized, expert guidance to streamline your development processes, boost efficiency, and achieve your project goals faster. Partner with us to unlock your team's full potential and drive innovation, ensuring your projects success.
  • Team Training and Development: Empower your team with the latest best practices in embedded software. Our expert-led training sessions will equip your team with the skills and knowledge to excel, innovate, and drive your projects to success.
  • Customized Design Solutions: Get design and development assistance to enhance efficiency, ensure robust testing, and streamline your development pipeline, driving your projects success.

Take action today to upgrade your skills, optimize your team, and achieve success.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.