izac89
izac89

Reputation: 3930

FreeSTOS task never get swapped

According to the FreeRTOS task scheduling documentation, the kernel can swap a task even if the task is currently executing and haven't called any blocking function. So once the kernel gets the clock ticks interrupt and is executing its ISR, it can schedule another task to execute after that.

On my system with FreeRTOS, I launch 5 tasks, each one is programmed to delay itself at some point and therefore I can see all tasks being swapped in and out and each task is executing at some point. But if I enter an infinite loop inside a task, that task is NEVER gets swapped out.

How is that possible?

Upvotes: 0

Views: 466

Answers (1)

Realtime Rik
Realtime Rik

Reputation: 1714

Firstly you need to ensure that configUSE_TIME_SLICING is set. This enables the round robin scheduler, which allows the scheduler to do what you are expecting.

Also it will only switch to another task if it is of equal or higher priority.

Upvotes: 2

Related Questions