Quality RTOS & Embedded Software

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




Loading

Implemented Scheduler Algorithm

Posted by modo.alex on July 9, 2010
Good day,

I have read the info pages on the site, but those regarding the scheduler algorithm look very vague to me.
So, FreeRTOS implements a dynamic priority algorithm for different priority tasks and round robin when tasks have the same priority.
I concluded, studying it's operation, that if only static priority assigment would be used ( no vTaskPrioritySet() ), we could state that Rate-Monotonic Scheduler algorithm is used.

Priority Inversion cases handled with portENTER_CRITICAL() and portEXIT_CRITICAL() and mutexes?

Pleaese correct me if i'm wrong.


Beast Regards,
Alex

RE: Implemented Scheduler Algorithm

Posted by Richard Damon on July 9, 2010
First, portENTER_CRITICAL and portEXIT_CRITICAL do nothing for Priority Inversion to my knowledge, it is solely handled by the mutex code by temporarily raising a tasks priority if it holds a mutex that a higher priority task wants. (And I believe it makes the assumption that said task will not get a second priority boost while this boost is occuring).

I would not assign the blanket description of the Scheduler as "Rate-Monotonic" as that description means that the tasks with the shortest periods get the highest priority. While the programs CAN assign the priorities in this manner, freeRTOS does not enforce this, One reason is that sometime you can have tasks with low processing rates, but short deadlines (when data arrives, it needs to be processed NOW, but data comes infrequently).

A better description is that FreeRTOS uses Hard Priorities (a lower priority task will never get time, if a higher priority task is ready) with a simple Round Robin scheduling for tasks at the same priority. This leads to the possibility of lower priority tasks getting starved for time if the higher priority tasks use it all, and that tasks at the same priority, while they share time, may not all get equal time. The issue is that if one task uses up most of a tick, and then blocks, the next task at that priority only gets a part of the tick to process before the timer tick arrives and forces a reschedule. A more complicated system might measure how much time has been used (sub tick interval) and schedule based on lowest recent usage, not longest since ran to be more "fair" at this time allocation (at the cost of more overhead and less portability).


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists