From the course: Introduction to FreeRTOS and Basic Task Management
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Understanding context switching in RTOS
From the course: Introduction to FreeRTOS and Basic Task Management
Understanding context switching in RTOS
- [Instructor] Let's look at context switching, a critical concept in operating systems. Context switching refers to the process of saving the state of the currently running thread and restoring the state of the next thread that the CPU will execute. Context switching is essential because it allows the RTOS to efficiently manage multiple threads by pausing one thread and switching to another, depending on priority or time slice scheduling. Let's walk through the process. Let's say the RTOS is currently executing Thread 1, and it wants to execute Thread 2. This is what happens. First, it saves the execution state of Thread 1, and then it restores the execution state of Thread 2, and then it executes Thread 2. Now, what if it wants to go back to executing Thread 1? Then it would save the execution state of the currently running thread, which is Thread 2, and then restore the execution state of Thread 1, and then it would run Thread 1. This cycle allows multiple threads to share CPU time…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
What is a real-time operating system (RTOS)?3m 18s
-
(Locked)
Importance of RTOS in embedded systems3m 19s
-
(Locked)
The concept of a thread2m 51s
-
(Locked)
Understanding context switching in RTOS2m 24s
-
(Locked)
Introduction to ISR and busy-wait systems2m 6s
-
(Locked)
Comparing RTOS with ISR and busy-wait systems1m 22s
-
-
-
-
-
-