Skip to content
0:00 / 0:00

#rtos#cortex-m#contextswitching

#22 RTOS Part-1: What is a Real-Time Operating System?

Quantum Leaps, LLC

74K subscribers • 20 videos on Hallway

YouTube

Intermediate. Assumes working knowledge.

167K views8 years ago7 recommendations

Systems programmingHardwareOperating systemsEmbedded systemsConcurrency and parallelism

Miro Samek explains the fundamentals of Real-Time Operating Systems and how to implement a basic context switch.

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. ------ Resources: Companion web page for this video course: state-machine.com/quickstart GitHub repository for projects for this video course: github.com/QuantumLeaps/modern-embedded-programming-course Transcript of this lesson: state-machine.com/course/lesson22.txt Music credits: The background music comes from: bensound.com/royalty-free-music/track/straight

Why it's here

7 people recommend this

What people say. Highly recommended by embedded engineers as an excellent, hands-on introduction to RTOS concepts and context switching on ARM Cortex-M.

u/nukestar101in r/embedded • Recommends

On “RTOS concepts”

You need to get your hands dirty with RTOS and at the same time get to know RTOS, the mistakes you will make will help you to grasp the concepts better. Here are some resources which you can refer * Embedded Programming lesson * Mastering FreeRTOS kernel get yourself a development board like STM or esp32 and you will get freeRTOS ported right away and can learn by implementing things on hardware.

u/EE_Timin r/embedded • Recommends

On “Operating system Implementation”

QuantumLeaps on YouTube has a great series where he goes through the implementation of an RTOS.

u/crashandburnin r/embedded • Recommends

On “STM32 multithread program issue”

There's no OS so you can't use the normal methods for multi-threading. You have 2 choices: 1. use an RTOS, or, 2. implement your own context switch If you are looking to use the code for work or something serious, consider using an RTOS like FreeRTOS (https://freertos.org/). There are many others too: https://www.osrtos.com/ If you want to learn how to do this, its quite easy :) . See https://www.adamh.cz/blog/2016/07/context-switch-on-the-arm-cortex-m0/ , link to this video or search for more.

u/AirIllustrious8593in r/C_Programming • Recommends

On “I want to build an OS”

It's implied that you want to create an OS for a PC. If you wanted an easier task, you could try your hand at writing an RTOS. Miro Samek has a great video series which covers the basics, and the core concepts are relevant whichever platform (embedded or not). [video

u/Svimesenin r/embedded • Recommends

On “Writing a simple RTOS?”

Theres a series on YouTube where the instructor has gone through the steps of creating a simple RTOS from scratch. Might be worth a look: link to this video

u/active-objectin r/embedded • Recommends

On “Any good RTOS learning material out there?”

There is an in-depth RTOS course on YouTube. This hands-on course is based on the ARM Cortex-M processor and contains 7 videos about 30 minutes each: 1. Part-1: shows how to switch among multiple "superloops" on a single CPU and introduces the concept of the context switch 2. Part-2: shows how to automate the context switch and starts to build a small RTOS kernel 3. Part-3: shows how to automate the scheduling process and adds round-robin scheduling to the the RTOS kernel 4. Part-4: shows how to replace the inefficient busy-waiting (time delay) with efficient \*blocking\* and introduces the concept of thread states and the idle thread 5. Part-5: explains what "real-time" means a…

u/74300291in r/embedded • Recommends

On “How should I learn RTOS?”

Thanks, I was on mobile. Here's a link to the RTOS-specific playlist as well.

u/active-objectin r/embedded • Recommends

On “ARM Cortex-M RTOS Context Switching”

If you want to actually **see** the RTOS context switch on ARM Cortex-M, you might want to watch the "RTOS part-1 video" on YouTube.

u/active-objectin r/embedded • Mentions

On “What advice would you give junior engineers?”

A junior engineer needs to understand the key concepts of the discipline. The deeper you understand the fundamental concepts, the better will be your prospects in the profession for years to come, because fundamental concepts never go out of style. But to truly understand a concept, I always found it necessary to see how it worked at a **low level**. That invariably helped me to grasp the concept deeper and apply it more confidently and efficiently. For example, to understand a function call mechanism, it helps immensely to step through a call in a debugger (in disassembly) and *see* the call stack in memory as well as the CPU registers. Similarly, to understand a virtual call in C++ it…

u/active-objectin r/embedded • Mentions

On “How to find out how to write an operating system”

The best way of learning anything is by doing. So to learn how to write an RTOS, you need to see it being done and follow along. This is exactly the approach taken in the free YouTube video course, which offers a 7-lesson segment on RTOS. You will build there a small "Minimal Real-time Operating System (MiROS)" for ARM Cortex-M. You will start with performing context switching manually, and then you will automate the process in assembly. Then you will build schedulers, first time-slicing round-robin and then preemptive, priority-based. You will learn about real-time and Rate Monotonic Scheduling. You will see how all this works using a logic analyzer. The RTOS code, and the examples are a…

u/active-objectin r/embedded • Mentions

On “Is this course still a good resource for a relative beginner?”

The referenced "Embedded Systems - Shape The World" course is taught by prof. Valvano and prof. Yerraballi from the University of Texas. You can check out the teaching style by watching some videos of prof. Valvano posted on YouTube. For example, here is a video in which prof. Valvano introduces the RTOS (Real-Time Operating System). I'm not sure if I could understand what RTOS is from that video, though. For a different teaching approach, perhaps you could check out the free video course "Modern Embedded Systems Programming" on YouTube, which is based also on the TivaC LaunchPad board (ARM Cortex-M4), the exact same one used in Valvano's course. For example, here is a video ["What is…

u/beige_cardboard_boxin r/embedded • Mentions

On “I have an RTOS interview next week. What questions should I expect? ”

Read these two documents: - https://www.freertos.org/Documentation/02-Kernel/07-Books-and-manual/01-RTOS\_book - https://greenteapress.com/wp/semaphores/ Watch this youtube series: - [video (loud) Everything u/sturdy-guacamole said, and another good trivia question is to explain the difference between a binary semaphore and a mutex.

u/Acrobatic-Zebra-1148in r/embedded • Mentions

On “Resources for writing my own simple RTOS”

[video