Quality RTOS & Embedded Software

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


an optimization to EventList

Posted by ares.qi on June 22, 2005
Eventlist is sorted by ascending task's priority order, so lower priority task is in the front of the list and higher priority tasks is in the back of the list.

but in xTaskRemoveFromEventList(),
at line 1287 in tasks.c , there is

pxUnblockedTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
vListRemove( &( pxUnblockedTCB->xEventListItem ) );

from these code, we know we are glad to get the head of the list ---- remove the lowest task from the pxEventList. In common, this is not very effective, we should try out best to assure high priority task to use more system resource.

So when we remove a task from the pxEventList , we should always remove the highest priority task firstly, i think.

we can solve this problem by this:

(at line 1421 in task.c prvInitialiseTCBVariables() )

listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) uxPriority );

====changed to ====>>>

listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );

RE: an optimization to EventList

Posted by Richard on June 22, 2005
Again, this seems to be a good suggestion. Keep it up!

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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner