filmov
tv
Introduction to RTOS Part 3 - Task Scheduling | Digi-Key Electronics
Показать описание
The RTOS scheduler decides which task to run on a recurring basis, and some tasks can interrupt and run before other tasks in a process known as “preemption.”
CORRECTION at 2:37: A higher priority task in FreeRTOS will immediately preempt other tasks and run if it is made ready. It does not wait for the next tick to run. Thanks to @G-aurav B-hattarai for pointing this out!
In this video, we examine how the FreeRTOS scheduler makes a decision at every tick (recurring timer interval) to determine which task to run for the remainder of the tick. With a single-core processor, this time-slicing allows tasks to run in a fashion that appears to be concurrent to the user.
Tasks with higher priority are chosen to run before tasks with lower priority. However, not all tasks need to be run. Only tasks in the “ready” or are already in the “running” state can be chosen to run next. A task may put itself or another task in a “blocked” state by using one of the appropriate blocking functions, like vTaskDelay(). Tasks that are waiting for an external event, such as a free semaphore or a serial transmission, may also enter the blocked state. The expiration of a timer or received resource may move a task from the “blocked” state to the “ready” state.
Additionally, a task may put another task into the “suspended” state with the vTaskSuspend() function. This prevents the suspended task from running until another task calls the vTaskResume() function on the suspended task.
Note that tasks with equal priority are executed in a round-robin fashion.
Product Links:
Related Videos:
Related Project Links:
Related Articles:
Learn more:
CORRECTION at 2:37: A higher priority task in FreeRTOS will immediately preempt other tasks and run if it is made ready. It does not wait for the next tick to run. Thanks to @G-aurav B-hattarai for pointing this out!
In this video, we examine how the FreeRTOS scheduler makes a decision at every tick (recurring timer interval) to determine which task to run for the remainder of the tick. With a single-core processor, this time-slicing allows tasks to run in a fashion that appears to be concurrent to the user.
Tasks with higher priority are chosen to run before tasks with lower priority. However, not all tasks need to be run. Only tasks in the “ready” or are already in the “running” state can be chosen to run next. A task may put itself or another task in a “blocked” state by using one of the appropriate blocking functions, like vTaskDelay(). Tasks that are waiting for an external event, such as a free semaphore or a serial transmission, may also enter the blocked state. The expiration of a timer or received resource may move a task from the “blocked” state to the “ready” state.
Additionally, a task may put another task into the “suspended” state with the vTaskSuspend() function. This prevents the suspended task from running until another task calls the vTaskResume() function on the suspended task.
Note that tasks with equal priority are executed in a round-robin fashion.
Product Links:
Related Videos:
Related Project Links:
Related Articles:
Learn more:
Комментарии