Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Task with the same level

Posted by ulmus on October 9, 2011
I cannot find it with clear explanation: e.g. i have many tasks with the same level/priority then.... are they started one by one every tick and after the last there is started first task and so on? What if one task longs longer then one or more tick period? Is there then task switch?

RE: Task with the same level

Posted by MEdwards on October 9, 2011
Tasks that have the same priority and are in the ready state will run in turn, with a task switch on each tick interrupt (or task yield), but are not guaranteed to get the same amount of running time. For example, interrupts might take up some time.

RE: Task with the same level

Posted by Richard Damon on October 9, 2011
Basically what FreeRTOS does (when configured for preemption, and the schedule is not currently suspended) is on the Tick Interrupt, the current task Yields, which suspends the current task, and moves it to the end of it ready queue. It then schedules the task at the front of the highest ready queue with an available task. This will generally cause the tasks of a given priority to run is sequence. Ad Edwards says, this doesn't mean they will all get equal time, not only due to interrupts, but if higher priority tasks unblock, they will take time from the current task. At a pathological extreme, one of the tasks could be checking the timer tick and just before the tick comes could start a higher priority task (that runs long enough to go past the timer tick), and I believe it will restart when the higher priority task finishes, perhaps starving other tasks at its level, or it could yield just before the timer tick, causing the next task in sequence to get short changed for it share of the tick. This is one reason while the idle task can be configured to yield or not. If it yields and there are two other tasks that share its priority, the one following the idle task will get short changed for time, while if it doesn't yield, they all will be given full slots, but you are losing some available time.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS