0% found this document useful (0 votes)
22 views11 pages

5 Real Time Operating System FreeRTOS Kernel Part 3

The document discusses FreeRTOS and task scheduling. It describes the idle task, which has the lowest priority and sits in a loop when no other tasks are running. Developers can use an idle task callback to perform low priority processing. It also explains how to change task priorities dynamically using code examples. Finally, it summarizes that FreeRTOS uses fixed priority preemptive scheduling, where the highest priority ready task runs and lower priority tasks can preempt running tasks.

Uploaded by

Hegazy Hegazy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views11 pages

5 Real Time Operating System FreeRTOS Kernel Part 3

The document discusses FreeRTOS and task scheduling. It describes the idle task, which has the lowest priority and sits in a loop when no other tasks are running. Developers can use an idle task callback to perform low priority processing. It also explains how to change task priorities dynamically using code examples. Finally, it summarizes that FreeRTOS uses fixed priority preemptive scheduling, where the highest priority ready task runs and lower priority tasks can preempt running tasks.

Uploaded by

Hegazy Hegazy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Real Time Operating System

“FreeRTOS”
Part 3

1
Agenda
• Idle Task Call Back
• Changing Tasks priorities
• Scheduling Wrap up
The Idle Task and the Idle Task Hook
(Idle Task CallBack)
• An Idle task is automatically created by the scheduler when
vTaskStartScheduler() is called.
• The idle task does very little more than sit in a loop
• The idle task has the lowest possible priority (priority zero), to ensure
it never prevents a higher priority application task from entering the
Running state
• Idle task is always pre-empted by higher priority tasks
• idle hook (or idle callback) function—a function that is called
automatically by the idle task once per iteration of the idle task loop
• Common uses for the Idle task hook include:
– Executing low priority, background, or continuous processing.
– Measuring the amount of spare processing capacity.
– Placing the processor into a low power mode
• configUSE_IDLE_HOOK must be set to 1 within FreeRTOSConfig.h for
the idle hook function to get called.
Example 7: Idle Task CallBack
Example 7: Idle Task CallBack

How many times IdelTask is called between tasks calls?


Changing task priorities; Example 8
Changing task priorities; Example 8
Changing task priorities; Example 8
Changing task priorities; Example 8
The Scheduling Algorithm—A Summary

• Fixed Prioritized Pre-emptive Scheduling


– Each task is assigned a priority.
– Each task can exist in one of several states.
– Only one task can exist in the Running state at any one time.
– The scheduler always selects the highest priority Ready state task to enter the
Running state.

• Fixed Priority’ because each task is assigned a priority that is not


altered by the kernel itself (only tasks can change priorities);

• ‘Pre-emptive’ because a task entering the Ready state or having its


priority altered will always pre-empt the Running state task, if the
Running state task has a lower priority.
The Scheduling Algorithm—A Summary

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy