In this 1st lesson on RTOS (typically pronounced [är-tos]), you will see how to lengthen the foreground/track record architecture to have a number of qualifications loops running seemingly concurrently.
Following introducing interrupts and the foreground/track record architecture, I am ultimately prepared to deal with the idea of a Real-Time Operating Method (RTOS). In this initially lesson on RTOS (usually pronounced [är-tos]), you will see how to extend the foreground/qualifications architecture to have various history loops functioning seemingly concurrently.
Lesson 22 – RTOS: What is a Real-Time Working Procedure?
Extending Sequential Paradigm
Your exercising for now is extending the sequential model of the “Blinky” method from the past lesson so that it can also blink a 2nd LED at a diverse amount than the 1st a person. The lesson-22 video reveals that a one qualifications loop are unable to take care of this devoid of completely destroying its basic sequential construction. But how about two independent qualifications loops (just about every blinking a diverse LED)? These two history loops can keep on being straightforward and sequential, with the sequence of activities really hard-coded in the calls to the blocking BSP_delay() purpose.
Hijacking Interrupts for Context Switching
The “only” dilemma with two track record loops is building a single CPU run them somehow simultaneously. But the CPU already has the interrupt processing hardware, which makes the interrupts and the background loop run seemingly at the same time. Could this system also create a identical illusion for several history loops?
Ordinarily, every single interrupt (SysTick in the movie) returns to the actual stage of preemption in the original background loop. But what if that interrupt could return to a various background loop? The movie displays how you can manually “hack” the interrupt stack frame in the debugger to do just that, so “hijacking” the interrupt mechanism for switching in between qualifications loops need to be doable.
True-Time Working Program Kernel (RTOS Kernel)
The manual context switching shown in the video clip can be automatic in unique software identified as the Genuine-Time Running Method Kernel or RTOS-Kernel for small.
RTOS-Kernel is application that extends the fundamental foreground/qualifications architecture by permitting you to operate several qualifications loops (termed threads or duties) on a one CPU. The major work of the RTOS-Kernel is to change the CPU context commonly from a person thread to another to generate an illusion that all this kind of threads run concurrently. This approach is also referred to as multithreading or multitasking.
Of training course, there is far more to RTOS than just context switching, and I will talk about these other aspects in several future lessons of this course. But from this first introduction, I’d like you to consider absent the significant image: the key reason of an RTOS is to increase the sequential programming paradigm that we all know and like . An RTOS permits you to compose your applications out of various sequentially-programmed threads, hence extending the sequential programming paradigm with a useful assets known as composability.
In this lesson, you labored out a somewhat laborous guide technique for switching the context from 1 thread to yet another. Nonetheless, the moment you have an genuine context switch algorithm, automating it in computer software is pretty workable. And this is exactly the topic of the upcoming lesson, where you will commence building your personal RTOS-Kernel . Continue to be tuned!
 David Farley, “Synchronous Programming is the Crack-Cocaine of Application Enhancement,” YouTube movie, February 2023.
 Miro Samek, MiROS (Nominal Authentic-Time Running Procedure), GitHub
|Dr. Miro M. Samek is the creator of the open source QP true-time embedded frameworks and the freeware QM graphical design-centered layout instrument. He is also the founder and CEO of Quantum Leaps — the supplier of fashionable embedded software package primarily based on energetic objects and hierarchical condition equipment as nicely as instruments for visual modeling, automated code technology, and unit tests of deeply embedded software package. Miro teaches the preferred YouTube “Modern Embedded Devices Programming” online video program on which this write-up sequence is centered.|
For more Embedded, subscribe to Embedded’s weekly electronic mail publication.
Leading 10 Optimum-Having to pay Programming Languages in the Usa
Introducing JDK 21’s Tactic to Novice-Friendly Java Programming
Q&A with new Duke Arts Director of Programming Aaron Shackelford