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 ]    [ Sitemap ]    [ ]

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

Latest News

Meet us at Embedded World. Hall 3A-525.

Hear from Richard Barry at Embedded World. Feb 28, 16:00, Hall 4-428.

Video: Watch James Gosling & Richard Barry at re:Invent, Las Vegas 2017.

FreeRTOS kernel V10.0.1 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