Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? | Digi-Key Electronics
Вставка
- Опубліковано 12 тра 2024
- A real-time operating system (RTOS) is an operating system that runs multi-threaded applications and can meet real-time deadlines. See this article to read more about them: www.digikey.com/en/maker/vide...
An RTOS is often a lightweight operating system (OS) designed to run on microcontrollers. Much like general purpose operating systems, they offer a scheduler to run multiple threads or tasks, resource management (such as file I/O), and device drivers. An RTOS is necessary when embedded engineers need to run several threads at the same time on a processor.
The “real-time” part of an RTOS means that such software can meet real-time deadlines. Note that this does not mean “fast,” but rather, it can guarantee that task execution time can be calculated prior to runtime.
Embedded programmers often use a “bare-metal” or “super loop” structure instead of an RTOS when concurrency is not needed. This is the familiar “setup” and “loop forever” style of embedded code where no OS is employed. Many embedded applications can be written in this format, and they are often easier to debug.
In the rest of the series, we will cover various RTOS concepts and provide demonstrations on the ESP32 using Arduino. After each video, excluding this one, we will issue a challenge and the solution can be found in a Maker.IO link provided in the video’s description. We encourage you to try the challenge without looking at the solution.
Product Links:
www.digikey.com/en/products/d...
Related Videos:
Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? - • Introduction to RTOS P...
Introduction to RTOS Part 2 - Getting Started with FreeRTOS - • Introduction to RTOS P...
Introduction to RTOS Part 3 - Task Scheduling - • Introduction to RTOS P...
Introduction to RTOS Part 4 - Memory Management - • Introduction to RTOS P...
Introduction to RTOS Part 5 - Queue - • Introduction to RTOS P...
Introduction to RTOS Part 6 - Mutex - • Introduction to RTOS P...
Introduction to RTOS Part 7 - • Introduction to RTOS P...
Introduction to RTOS Part 8 - • Introduction to RTOS P...
Introduction to RTOS Part 9 - • Introduction to RTOS P...
Introduction to RTOS Part 10 - • Introduction to RTOS P...
Introduction to RTOS Part 11 - • Introduction to RTOS P...
Introduction to RTOS Part 12 - • Introduction to RTOS P...
Related Articles:
www.digikey.com/en/maker/vide...
Learn more:
Maker.io - www.digikey.com/en/maker
Digi-Key’s Blog - TheCircuit www.digikey.com/en/blog
Connect with Digi-Key on Facebook / digikey.electronics
And follow us on Twitter / digikey - Наука та технологія
Glad to see you back at it. I watched all your Arduino videos today, and I've seen all your STM32 videos as well. This is awesome content, and I can't wait for the next video in this series.
This is exactly the informational/tutorial series I've been looking for. Even better I found it after it's all done, so I can go straight through it! Thanks!
This video series is a goldmine for me, as I want to pursue embedded systems. Thank you very much for this and more videos to come such as this.
I remember 2 decades back when I got a little catalog from them. Only the size of a Readers Digest condensed book, for those that remember those. Now they sit prominently and honorably on the World stage, with a catalog too big to ship, and CS reputation unmatched in my history. Keep it up!
This intro is as good as any I've seen, especially relevant for deciding if the complexity of RTOS is warranted. In my case, it's not but I feel better sticking with the super loop.
Thanks for coming up with this tutorial. Was really waiting to explore more on RTOS
Great video. Other tutorial online are either too hard or too basic, this series of video just match the hole in this field.
Thank you, Dr. Digi-Key.
In real time, the narration is displayed in text in the right window of the video. This feature is very useful for me, who has never spoken English.
Yes!!! Edge Ai and now RTOS!! Love your stuff! please dont stop Sir! These things are actually the next biggest trends. Thanks Sir.
You explained it so perfectly. I was having such hard time understanding RTOS in my embedded systems class this helps incredibly. Thank you for being so informative.
That's exactly what inspired me to do this series--I was not a fan of how they were taught in school :)
How can I take an embedded systems class like yours?
As a game programmer for 30 years, when I learned iOS Swift, I had to change my way of thinking about code because Swift doesn’t function like other languages I’ve used. In Swift, there is NO “main loop”. In fact, the Apple device’s OS is the main loop of your app. Everything in your app is accessed by interrupt handling, either a timer interrupt or a human interrupt, like a button push.
Same in JavaScript, where we also don't have a main loop, programs are functions responding to events like clicking a button (or in case of Node.js like an incoming server request). And the browser is the "operating system" (or Node.js or Bun or whatever else).
Okay, a function calling itself recursively using requestAnimationFrame could be something like a "main loop", it's done mostly in games using canvas element...
@@mieszkogulinski168 if swift and JS are the same in this regard, they are event driven languages and a loop is still involved, the event loop.
That’s exactly what I felt the first few times I wrote BREW Apps (Qualcomm’s missed opportunity to become Android).
This series is a godsend. Excited for the upcoming tutorialsm
Guy, your explanation is so simple and clear
Cannot wait for this series to be completed.
Thanks for the excellent series. Explains FreeRTOS in an approachable manner including excellent examples and tips.
It is really awesome to see this.
-A fan
It's the bowtie that keeps me glued. LOL. Thanks for adding a bit of levity to this talk.
Thanks @Shawn Hymel: Looking forward to the rest of the parts on RTOS !!!
Everything is best explained in this video. Cleared the conecpets. Thanks 👍
Really not sure what I dig more, the presentation or the music. Great job!
Top-notch video, please continue this series, thanks
I've been looking for Shawn. since he left "that other maker site". I like Shawn's style, and his teaching style works for me. He and Digi-key get my vote and more of my business.
Thank you for your kind words!
Yeahhh!!.. After learning RTOS in books and Online resources, I got the best from Shawn.
Very good video, I have subscribed , compliments. Many teachers didn't know the difference between thread and task, only this is worth the video
It's so well done video. I love the series.
Much awaited Topic!
Exactly what I needed for my PowerPoint presentation about OS. Thanks man
This is such a great video, very much looking forward to the next one!
Clearly explained, clearly articulated. Thank you.
7:40 To be fair, an ESP32 is much cheaper than an Arduino, and has BT/WiFi so I tend to use them even for projects they are wildly overpowered for. Super loops are great for simple projects just due to the law of fewer moving parts. Faster to develop, lower surface area for bugs. Project complexity is the primary deciding factor.
Most industrial automation, for example, runs on PLCs, and they are almost universally super loop architectures. Huge scale, loads of I/O, long programs, but still low complexity.
Excellent summary, in any case.
very much resourceful, waiting for the next video 💙
Very good introduction video for RTOS! thank you for sharing this knowledge
Great i am searching for video like this u know what i found u just one day after u just post ur video, thank u very much i am very eager for next video.
Just starting a career in embedded systems, and I'm looking forward to your tutorials. I like your style.
@MichaelKingsfordGray So what would it be? C++ ? Where is FreeRTOS based on? Where is ChibiOS based on? Where is Linux RT based on? All on "C" ?
When exploring embedded systems, then it is also worthwhile looking at the Orange Pi Zero board. This gives you 4 ARM A7 cores with proper DMA EMAC Ethernet.
@@ArjanvanVught Thanks!
so well explained love this video
Very well illustrated. Loved the content delivery
Thank you Shawn!
There are instances of asynchronous execution within a super loop. Either by calling inbuilt functions or using command patterns, although I guess functionally they're no longer a loop even if they are structurally
Outstanding overview. Thank you!
Thank you for making these tutorials)
Waiting for the next video!
Really informative and helpful.
Thank you so much !! You answered a lot
Thank you for making these videos!
Well explained one... Thanks for sharing
Finally... Event-driven microcontroller for real! 😁
With a super-loop you would need to implement a state-machine. Hence no locking of tasks. Hence no context switching overhead.
This is top quality content. Thanks!
Great work 👍
Awesome video.. 👍🏻👍🏻
Thank you..
thanks,,,,, very nicely described,,,,, one thing missing was the example of some rtos
Thanks for the great effort you put into making this great introduction.
9:28 Got it. Won't use it then. No guarantee on it's future paths in that case. Your videos are great though for understanding these concepts.
Wow, I just stumbled upon this channel by sheer luck! (Subscribed!)
My question. Where is the line in between assembler code (machine code) run by CPU, so when you create your code on that level, interrupts, loops, and where RTOS begins? I have feeling it is somehow in between just machine code and GPOS, a bit advanced than super loops.
thank you!
Great post
Good explanation
My first experience with a RTOS was a lighting console that ran on VXWorks!
Very interesting. A multi-tasking
Computer. Must be a real head-
Ache to program. Wondering
How many tasks can be performed
In real time. Must be like dealing
With a woman. Gods only real
Time biological multitasking
Creature.
Thanks Shawn, the tutorial is very nice. One request would like to make is, music is too loud and your voice is quite low, please make adjustment for better experience. Regards
Thanks for the heads up! I'll work on getting the volume down of that intro/outro music.
Great full ideas
You are the best!
Nice video, thanks :)
I remember, many moons ago, I had a RTOS version on an EPROM cartridge attached to my Atari ST. Many moons ago.
My older brother developed on Atari 1040 ST and a 520 ST computers. The operating system on those 68000 based processor systems was called TOS. The OS was burned onto internal ROMS on the main board. There was something called "realtime" for a musical cartridge back on Jun of 1991.
@@JohnWasinger Tramiel Operating System ... good ol’ days. Enjoyed that one quite a bit with the M68k family over the years. Was used where I had my first programmer job too for various application. Even developed a TokenRing network and integration into TOS.
Great video, great audio, thanks for the smart lapel mic!
Well, the music is too loud compared to the voice, otherwise it's ok
@@webfreezy No, it's great!
Shawn you are a literal embedded god. Thank you so much for your videos
So if I understand that correctly, the only difference between GPOS and RTOS is the way task switching is handled so that timing deadlines are met? But isn't this already possible in modern GPOSes as well?
Great Video, but in your comparisson of RTOSs, you don't mention MS_Azure (ThreadX etc) [typical MS compexity, but FOC on STM32 & fully certified]
great video!
6:59 hardware comparison chart
9:52 "Any board will work as long as they've an associated arduino package"
9:52 I can already hear the booooooo's
@@mondherbenromdhane2069
Why thou??
Also do I need engineering background as I got none
I have been running into a situation where I need something to be timed. The problem, is when the timeout occurs at some point in time when the loop is doing another process.. Let's say the loop takes 11 to 14 seconds to repeat and I want my screen to stay lit for 90 seconds..
I can't guarantee when the loop will check when the screen timer reached 90(not after). It can only tell if the set time has gone past the timeout.. (Just like your piston catastrophe reference).
Is there anything like a timer interrupt?
A bow tie?
A have to take a bow in front of such audacity.
And yes, it is a great video indeed.
What is RTOS?
Ans: its like any other operating system.
Very helpful thankyou.
great video
Waiting for the next video
whats is pwm is called task thread or process and how fast will it excute during multitasking? with more pwm?
Hello sir,
when i remove while(1) in toggleLED function, behaviour is same. does free rtos schedule same task again and again.
here is the code i used
#if CONFIG_FREERTOS_UNICORE
static const BaseType_t app_cpu = 0;
#else
static const BaseType_t app_cpu = 1;
#endif
static const int led_pin = 2;
void toggleLED(void *parameter)
{
gpio_set_level(led_pin, 1);
vTaskDelay(500 / portTICK_PERIOD_MS);
gpio_set_level(led_pin, 0);
vTaskDelay(500 / portTICK_PERIOD_MS);
}
void app_main(void)
{
gpio_set_direction(2, GPIO_MODE_OUTPUT);
xTaskCreatePinnedToCore(
toggleLED,
"Toggle LED",
1024,
NULL,
1,
NULL,
app_cpu);
while(1)
{
;
}
}
Hello reference height I want to know my room floor level how much height from other room in which video solution
You did not mention state machine cooperative multitasking, a task doesn't hog the system but instead do snippets and then for example tell schedular to come back in 250ms with the option that a tasks IRQ can tell the event handler to run this task "right away" I wrote my own in 50lines of C code. example of usage:
OS_Interval_Next(this,5*1024); // give it 5sec time before turning off swclk pin
Does an RTOS' delay function (ex. FreeRTOS' vTaskDelay()), allow the scheduler to run other tasks? Actually, even if a low-priority task sits in a tight while(1), isn't the whole point of an RTOS to have the ability to wrestle away the CPU after too much time?
I have a motor control application, and would like if a task receives a command in the queue, it will move until it reaches the destination (30+ seconds). If another command is received while it's moving, it must stop and go to the new position. Maybe the task could look like:
wait for queue command
start motor moving
Continuously check position and stop when reached OR stop when new queue command is received
Would monitoring the position block/starve all other tasks? If so, what's the proper way for it to closely monitor position while still allowing the RTOS to run other tasks?
Howdy, I understand the need to present these topics in a digestible and simple way, but could you please tell me where can I find more info?
OH... Since you are the KiCad guy, I need to ask for something... Can you make a Footprint repository for KiCad and make it sync with the Boards Manager in the Arduino IDE..
(Look up and Download footprint of the board I selected in the Arduino Boards Manager)
Also.. How would I make a board for something like the S-100 bus?
I may be late but you earned a new sub today. I am going to invest in this kit. This looks fun, takes me back to my 8080 days as a kid.
TSpark is the most interesting rtos architecture. The only really original architecture in the market.
is it possible to attach a encoder running on 1500RPM and at the same time its reading data from ADC?
How did I wander here? I was just watching documentary on ICs. This is interesting though :)
Is it possible to run a I2c device in one of them Tasks ? So far i haven't seen any examples of that. ie. as5048 Position sensor running on one core and making its Angle data available globally to the other core..I cant get it to work.
Great video! Nice articulation
good video, need to crank up the volume a bit.
You said RTOS can do multitasking but what is the difference from multi core cpu, that can also do multi tasks with core funtioning individually?
Great question! A multi-core processor is something that's done in hardware: it allows you to run code concurrently on separate cores. An RTOS (or most OSes for that matter) can make it seem like you're running tasks concurrently (even on a single core) by rapidly switching between tasks. I recommend watching Part 2 to see how that's done. Some OSes are configured to handle multi-core systems, so you can have multiple cores that switch among tasks (all running on top of the same OS). In Part 12 (to be released), I show how you can use FreeRTOS with a dual-core system.
Thanks, great video but do you mind to turn down the music volume at the beginning - its waaaay louder then rest of the video
Thanks for the heads up! I'll work on getting the volume down of that intro/outro music.
You can run concurrent on super loop if you divide the tasks in switch statements and design non blocking, but this requires some years of experience.
The "divide tasks in switch statement" is what many call "state machine". More precisely, a hierarchy of state machines where each switch statement could be seen as a tree structure when matching the call tree.
Scheduler is kinda the core of an RTOS... loading/unloading/start/stop/suspend/resume tasks is core RTOS. Interprocess communication comes next.
5:08 You don't need to use multi-core processor for concurrency. If you have interrupt supported by hardware, why don't you use an external timer which fire interrupt every 1ms? So you could switch to the next task after the current task's quota expires.
This is _exactly_ how FreeRTOS works.
Were x86 cpus RTOS design until Core2Duo? eg. 486 cpus...
Can you run a program from an SD with FreeRTOS? Any of those RTOS can do it?
This *might* be possible. The best I can think is to create a compiled program that's stored on the SD card and then use a bootloader to read it into program memory. However, that doesn't have anything to do with an RTOS--it would be dependent on the microcontroller.
Dude: the ambush music is too loud!
Noted, thank you. It will be fixed for ep 3 and beyond.
@@ShawnHymel Thank you.
Absolutely agree...
Great!
awesome
Ganda Rei!