This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is priority inheritance implemented the right way in eCOS?


I am doing a bit of research in eCOS and I couldn't find the answer to
the following question: how is priority inheritance implemented in eCOS?
 
An explanation: a very well known RTOS that has the majority of the
market share nowdays implements priority inheritance in a simple way
which gets you high benchmarks when measuring scheduling latency but
renders your RTOS "pseudo-real-time" since end result is that low
priority tasks can end up stealing CPU time from the high priority ones.
Further explanation in words of Tod Litwin picked up from a discussion
list: 
 
"The problem is that when the low-priority task releases the mutex, the
task's elevated priority 
won't necessarily be lowered back to its proper level right away. This
only 
occurs if the task is still holding other inversion-protected mutexes.
The 
priority will only be returned to its proper level when the last such
mutex is 
released by the task. Until that time it's priority will not be lowered
at all, 
no matter how many times and through how many mutexes it's priority
needed to 
be raised through priority inheritance. (Note that if the task is
holding only 
one inversion-protected mutex at a time, there is no problem.) "
 
An example of how bad this can be, think of e.g. data base code: as soon
as a database function is entered, we obtain a semaphore protecting the
database.  A bit later we decide to read/write to flash.  We obtain
another semaphore protecting the flash.  The conditions for the above
problem have been met.  
 
BTW, this is documented as such in their API and the latest version of
the RTOS in question has the problem fixed.
 
Finally, the question: does eCOS lower the priority of the task with
inherited priority as soon as the particular semaphore is released or
does it wait for all the semaphores it owns to be released?
 
Thanks,
 
Stanko Vuleta

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]