Quality RTOS & Embedded Software

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




Loading

Relation between task priority and the scheduling interval

Posted by eswdev14 on January 11, 2017

Hi all,

I'am relatively a beginner with using FreeRTOS. I have a general, but important question about FreeRTOS and its scheduling interval. In what way is there a relation between the assigned task priority and its corresponding task schedule interval used by the FreeRTOS scheduler? Is there something to say about for example taskX has a priority of 4 and the corresponding scheduling task interval is say 3ms? Any help in guiding me I will appreciate!

Thanks, Max


Relation between task priority and the scheduling interval

Posted by hs2sf on January 11, 2017

prio and time slice / quantum are different things. There is no direct relationship in the sense you describe. Which higher level problem do you want to solve ? For example a periodic task can be setup by using a timer or just a timeout and choosing a prio matching your runtime system requirements.


Relation between task priority and the scheduling interval

Posted by richard_damon on January 12, 2017

FreeRTOS has a fixed ftask scheduling interval of 1 Tick, i.e. every tick the current running task is put at the end of the ready queue for its execution priority and the next task with the same priority (which might be the task just running) is then run. Since the class of machine that FreeRTOS runs on do not normally use virtual memory, there is little need to have lower priority tasks have a larger execution quantum.


Relation between task priority and the scheduling interval

Posted by eswdev14 on January 12, 2017

Thanks for the answer! But if I understand it correctly, can I use several hardware timers of the ARM microcontroller to have periodic tasks with FreeRTOS? If no, how can I configure/tailor FreeRTOS to have several periodic tasks which would be scheduled in say 2, 3 and 5ms in my microcontroller application? And how about configuring the SysTick timer used by the FreeRTOS scheduler? An example would be very helpful!


Relation between task priority and the scheduling interval

Posted by rtel on January 12, 2017

Hi Max - have a look here: http://www.freertos.org/Documentation/RTOS_book.html


Relation between task priority and the scheduling interval

Posted by hs2sf on January 12, 2017

Well, the most simple (hence often the best) approach could be to configure the SysTick period less or equal to your minimum period because Systick is the minimum resolution of timers resp. timeouts and use a dedicated task per rate. The periodic tasks are merely simple loops waiting for it's timeout to expire, doing housekeeping and wait again... The tasks can be prioritized accordingly and you're fine ;) Sure - there a number of alternative approaches, but probably with the price of increasing complexity e.g using hardware timers with ISRs usually signalling events to task context, etc. On the other hand using dedicated peridiodic tasks costs a bit more RAM needed for the task stacks..


Relation between task priority and the scheduling interval

Posted by simonjwright on January 12, 2017

You only get round-robin scheduling if configUSE_TIME_SLICING is 1.


Relation between task priority and the scheduling interval

Posted by rtel on January 12, 2017

Depends how you defined round robin scheduling. configUSETIMESLCICING prevents a context switch between tasks of equal priority just because of a tick interrupt - but tasks of equal priority will still take turns to execute.


[ 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