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!
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.