FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [May 2017 Threads]
Hi,
I wonder how the scheduler decides between two tasks with the same priority, when configUSEPREEMPTION equals to 1 and configUSETIME_SLICING equals to 0 (i.e. a context switch should not occur on a tick interrupt).
Thank you in advanced.
...the same way it does when configUSE_PREEMPTION is 1, it will always
choose the task of that priority that has been waiting the longest.
Sorry, I meant the same way it does when configUSETIMESLICING is 1.
And so :
the [way the] scheduler decides between two tasks with the same priority
is
...the same way it does when configUSETIMESLICING is 1, it will always
choose the task of that priority that has been waiting the longest.
FreeRTOS has a principle of "fairness":
● The runnable task with the highest priority will be selected
● If the are more runnable tasks with the highest priority, the one which is waiting the longest will go first
( where "runnable" means "ready to run", enlisted in the pxReadyTasksLists[]
)
As you probably know, configUSE_TIME_SLICING
needs configUSE_PREEMPTION
to be effective.
With time-slicing enabled, the clock-tick will force a task-switch, in case there are more runnable tasks of the same priority.
Without time-slicing enabled, a task must yield explicitly in order to switch to the next same priority-task.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.