public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Stanko Vuleta" <vuleta@nimcatnetworks.com>
To: <ecos-discuss@sources.redhat.com>
Subject: [ECOS] Is priority inheritance implemented the right way in eCOS?
Date: Fri, 27 May 2005 19:32:00 -0000	[thread overview]
Message-ID: <ADC77BC212BF9A449DC6812751CB501C0595EF@exchange.nimcat.corp> (raw)

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

             reply	other threads:[~2005-05-27 13:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-27 19:32 Stanko Vuleta [this message]
2005-05-27 20:46 ` Nick Garnett
2005-05-31  8:34 Stanko Vuleta
2005-05-31 19:37 ` Nick Garnett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ADC77BC212BF9A449DC6812751CB501C0595EF@exchange.nimcat.corp \
    --to=vuleta@nimcatnetworks.com \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).