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: Wed, 08 Aug 2007 08:10:00 -0000 [thread overview]
Message-ID: <20070808081015.GB29246@lunn.ch> (raw)
In-Reply-To: <20070808075810.250840@gmx.net>
On Wed, Aug 08, 2007 at 09:58:10AM +0200, Alois Z. wrote:
>
> -------- Original-Nachricht --------
> Datum: Tue, 7 Aug 2007 16:40:47 +0200
> Von: Andrew Lunn <andrew@lunn.ch>
> An: "Alois Z." <alois@gmx.at>
> CC: ecos-discuss@ecos.sourceware.org
> Betreff: Re: [ECOS] Thread activation disturbed by lower priority threads]
>
> > On Tue, Aug 07, 2007 at 04:02:34PM +0200, Alois Z. wrote:
> > > Hi,
> > >
> > > as I got no response to me questions (see below) I may have to add a
> > > few things for clarification.
> > >
> > > First of all I'm running an an AT91M5580A processor (thy phytec
> > > board). I changed the ecos settings so that the timer tick is now
> > > 1ms. The reason for this is that I need such a small tick for my
> > > application. Does this anyhow influence the scheduling
> > > algorithm. Are there settings that need to be adjusted appart from
> > > denominator, nominator and timesclice value?
> > >
> > > I did more measurements and found out that the timer DSR is really
> > > stable. even more stable than on some other systems (non ecos) I'm
> > > using. The problem is that the time between posting on the semaphore
> > > (the thread is waiting on) until the thread starts executing is
> > > varying largly. It seems that it is prolonged by other execution
> > > elements. And this even when the thread under question is the thread
> > > with the highest priority. would be great if this clearifies my
> > > problem a little bit more.
> >
> > If it is the highest priority runnable thread, as soon as the DSR
> > finished it should get to run. The only exception i can think of is if
> > some other thread has the scheduler locked. This would prevent a
> > context switch until the scheduler was unlocked.
> >
> > How to you do your timing between the DSR timer and thread running?
>
> I just set bits in both and can than see the timing on an
> oscilloscope. This works really good and I did the same measurements
> on different boards.
Do you set the bits just after the semaphore operations, or later,
when it does the real work? I'm just thinking about the mutex issue.
> > Does this high priority thread need to acquire a mutex etc? It could
> > be that something else has the mutex. So it has to wait for it to be
> > released. Priority inversion then happens. The lower priority thread
> > which holds the mutex gets boosted in priority to the priority of the
> > waiting thread. This should allow the low priority thread to finish
> > what it is doing and release the mutex. However there is one
> > wrinkle. eCos only undoes priority inversion when the thread releases
> > all its mutex, not just the mutex of interest.
> >
> > Andrew
> >
> There is may be a mutex the high priority thread has to wait for. It
> is just one and typically the lock time is rather
> short. Unfortunatly every thread will use this mutex so maybe thats
> the reason for my problem. As I think now of it it may be a bad
> design, but because of other constraints it will not be possible to
> remove this mutex. By the way it works on other real-time operating
> systems (e.g. ThreadX). So I should think on the riority inversion
> protocol for the mutexes, i'm right?
Just for the purpose of testing a theory, take out the mutex. If the
timing gets better, you know the mutex is the problem.
You might also want to look at kernel instrumentation.
http://ecos.sourceware.org/docs-latest/user-guide/kernel-instrumentation.html
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
next prev parent reply other threads:[~2007-08-08 8:10 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 [this message]
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
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=20070808081015.GB29246@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).