Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

#50 To block or NOT to block, that is the question! Blocking as technical debt…

5.7K views on YouTube

“To block or not to block?” is the single, most fundamental question determining the architecture of your embedded software. In fact, the issue of blocking is the most important discussion we can have in embedded programming, even though many embedded developers don’t realize that.

A traditional blocking RTOS is still the dominant approach, but this is changing. Concurrency experts increasingly see blocking as a *technical dept*, and therefore, non-blocking, asynchronous architectures are gaining more traction, especially in mission-critical systems.

#embeddedprogramming #rtos #async #eventdriven

Contents with Timestamps:
————————-
0:32 Blocking definition and types of blocking in embedded systems
0:42 Busy polling
1:17 Blocking in an RTOS (by context switching)
2:00 Why is blocking so important?
2:52 Software composability
3:18 State machine as an alternative to blocking
4:50 Input-driven state machine example
5:15 RTOS solution to non-composability of blocking code
5:58 Cost of blocking in RTOS: private stacks for all threads
6:10 Traditional embedded architectures classified by blocking/non-blocking
7:13 Changing landscape of embedded architectures
7:52 Event-driven programming (non-blocking) with traditional RTOS
8:00 Event-driven programming at NASA JPL
8:55 Event-driven state machines (e.g., UML statecharts)
9:25 Efficient non-blocking real-time kernels
10:05 Preemptive non-blocking kernel compatible with RMS/RMA
10:30 Summary: blocking as the defining characteristic of embedded architectures
10:45 Mission-critical architectures are predominantly non-blocking

End Notes:
———-
NOTE: there is no specific project download for this lesson.

Companion web page to this video course

Modern Embedded Systems Programming Video Course

GitHub repository for projects for this video course:
https://github.com/QuantumLeaps/modern-embedded-programming-course

Transcript of this lesson:
https://www.state-machine.com/course/lesson-50.txt

Referenced articles:
——————-
PX5 RTOS, “PX5 RTOS User Guide Version 5.1.1,”

User Guides


(requires login to download)

David M. Cummings, “Managing Concurrency in Complex Embedded Systems,”
Kelly Technology Group 2014
https://www.state-machine.com/doc/Cummings1006.pdf

D. Kalinsky Associates, “Messages for Intertask Communication,” 2010
https://www.state-machine.com/doc/Kalinsky2010.pdf

D. Kalinsky Associates, “New Directions in RTOS Kernels,” 2014
https://www.state-machine.com/doc/Kalinsky2014.pdf

Herb Sutter, “Prefer Using Active Objects Instead of Naked Threads,”
Dr. Dobbs Journal, 2010
https://www.state-machine.com/doc/Sutter2010a.pdf

Music credits:
————–
The background music comes from:
https://www.bensound.com/royalty-free-music/track/straight