embedded software boot camp

Embedded Programming Video Course Teaches RTOS

Sunday, January 20th, 2019 by Miro Samek

If you’d like to understand how a Real-Time Operating System (RTOS) really works, here is a free video course for you:

RTOS part-1: In this first lesson on RTOS you will see how to extend the foreground/background architecture from the previous lesson, so that you can have multiple background loops running seemingly simultaneously:

RTOS part-2: In this second lesson on RTOS you will see how to automate the context switch process. Specifically, in this lesson, you will start building your own minimal RTOS that will implement the manual context switch procedure that you worked out in the previous lesson:

RTOS part-3: This third lesson on Real-Time Operating System (RTOS) shows how to automate the scheduling process. Specifically, in this lesson you will implement the simple round robin scheduler that runs threads in a circular order. Along the way, you will add several improvements to the MiROS RTOS and you will see how fast it runs:

RTOS part-4: This forth lesson on Real-Time Operating System (RTOS) shows how to replace the horribly inefficient polling for events with efficient BLOCKING of threads. Specifically, in this lesson you will add a blocking delay function to the MiROS RTOS and you’ll learn about some far-reaching implications of thread blocking on the RTOS design:

RTOS part-5: This fifth lesson on RTOS I’ll finally address the real-time aspect in the “Real-Time Operating System” name. Specifically, in this lesson you will augment the MiROS RTOS with a preemptive, priority-based scheduler, which can be mathematically proven to meet real-time deadlines under certain conditions:

RTOS part-6: This sixth lesson on RTOS talks about the RTOS mechanisms for synchronization and communication among concurrent threads. Such mechanisms are the most complex elements of any RTOS, and are generally really tricky to develop by yourself. For that reason, this lesson replaces the toy MiROS RTOS with the professional-grade QXK RTOS included in the QP/C framework, parts of which have been used since lesson 21. The lesson demonstrates the process of porting an existing application to a different RTOS, and once this is done, explains semaphores and shows how they work in practice:

RTOS part-7: This seventh lesson on RTOS talks about sharing resources among concurrent threads, and about the RTOS mechanisms for protecting such shared resources. First you see what can happen if you share resources without any protection, and then you get introduced to the “mutual exclusion mechanisms” for protecting the shared resources. Specifically, you learn about: critical sections, resource semaphores, selective scheduler locking, and mutexes. You also learn about the second-order problems caused by these mechanisms, such as unbounded prioroty inversion. Finally, you learn how to prevent these second-order effects by priority-ceiling protocol and priority-inheritance protocol.

Tags: , ,

2 Responses to “Embedded Programming Video Course Teaches RTOS”

  1. Dave Comer says:

    First, I want to thank your for producing your lessons on RTOSs. Second, and because I am in the thick of trying to put the concepts learned from your entire embedded systems series (specifically the RTOS lessons and QPC). I would encourage you to continue the series adding the specifics of how to start a project and use QPC. Here’s where I want to be honest; your book is well written, but is very very hard to “dive in’ to practical usage (for beginners). Your Video lessons left off right where it was making sense and continuing that series would be perfect great transition to using QPC and continuing the book to dig into more of the theory. I am desperately trying to apply your techniques to existing projects at work and I hear from other co-workers new to QPC as to what I have written above from co-workers new to QPC. Please understand, I greatly value your work, the paradigm of QP, and _encourage_ you to “keep on trucking'”. I did, however, want to encourage you to continue the video series.


    • Miro Samek says:

      Hi Dave,
      Yes, I plan to “keep on trucking”, but it just takes a lot of time. As you probably noticed, the “Modern Embedded Programming” video course progresses historically, starting with “superloop” used in the earliest systems, through timesharing (the 1960’s), through preemptive RTOS (the 1970’s and 80’s). After this I plan to move on to newer stuff, such as object-oriented programming (1980’s) and event-driven programming (1980’s). All of this will set the stage to explain the paradigm shift from sequential to event-driven programming and to state machines (!). Stay tuned!

Leave a Reply