public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Alois Z." <alois@gmx.at>
Cc: eCos Disuss <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] Thread activation disturbed by lower priority threads]
Date: Fri, 17 Aug 2007 08:08:00 -0000	[thread overview]
Message-ID: <20070817080830.GD17702@lunn.ch> (raw)
In-Reply-To: <20070817072849.22110@gmx.net>

On Fri, Aug 17, 2007 at 09:28:49AM +0200, Alois Z. wrote:
> Hi,
> > 
> > How many mutex's does your lower priority thread hold? From
> > packages/kernel/current/src/sched/sched.cxx
> > 
> > void Cyg_SchedThread::clear_inherited_priority()
> > {
> >     CYG_REPORT_FUNCTION();
> > 
> > #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_SIMPLE
> > 
> >     // A simple implementation of priority inheritance/ceiling
> >     // protocols.  The simplification in this algorithm is that we do
> >     // not reduce our priority until we have freed all mutexes
> >     // claimed. Hence we can continue to run at an artificially high
> >     // priority even when we should not.  However, since nested
> >     // mutexes are rare, the thread we have inherited from is likely
> >     // to be locking the same mutexes we are, and mutex claim periods
> >     // should be very short, the performance difference between this
> >     // and a more complex algorithm should be negligible. The most
> >     // important advantage of this algorithm is that it is fast and
> >     // deterministic.
> > 
> > Does this explain what you see?
> >     

> I should have always only one mutex claimed per thread. And always
> only for a very short period. What if several threads waiting for
> one mutex with priorities from 2 to 6 

The queue of threads waiting for the mutex can either be in FIFO
order, or sorted into decreasing priority order. FIFO is fast where as
sorting the queue takes more time. I think the default is FIFO. Take a
look at CYGIMP_KERNEL_SCHED_SORTED_QUEUES.

> and the tread with priority 7 is holding the mutex. First of all
> will there be a reschedule after the mutex is realeased?

Yes, as soon as the higher priority thread is runnable, and the
scheduler is unlocked, there will be a context switch to the higher
priority thread.

          Andrew

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

  parent reply	other threads:[~2007-08-17  8:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-07 14:02 Alois Z.
2007-08-07 14:41 ` Andrew Lunn
2007-08-07 17:35   ` Paul D. DeRocco
2007-08-07 18:55     ` Andrew Lunn
     [not found]   ` <20070808075810.250840@gmx.net>
2007-08-08  8:10     ` Andrew Lunn
2007-08-16 20:05       ` Alois Zoitl
2007-08-16 20:22         ` Andrew Lunn
     [not found]           ` <20070817072849.22110@gmx.net>
2007-08-17  8:08             ` Andrew Lunn [this message]
2007-08-17  7:34 Alois Z.
2007-08-17  8:08 ` Pieter-Jan Busschaert
2007-08-17  8:14   ` Andrew Lunn
2007-08-17  8:46     ` Pieter-Jan Busschaert
2007-08-17  8:59       ` Andrew Lunn
2007-08-23 20:38   ` Alois Zoitl

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=20070817080830.GD17702@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alois@gmx.at \
    --cc=ecos-discuss@ecos.sourceware.org \
    /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).