All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Charles Clerdan <charles.clerdan@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] question about priorities
Date: Wed, 08 Sep 2010 16:18:59 +0200	[thread overview]
Message-ID: <1283955539.24088.55.camel@domain.hid> (raw)
In-Reply-To: <AANLkTi=J9DJvEE274+rDiYBrqQSt7kNRZ3oW9+KPW7ra@domain.hid>

On Wed, 2010-09-08 at 13:45 +0200, Charles Clerdan wrote:
> Hi,
> 
> 
> I have a technical question about priorities under Xenomai.
> 
> According to my research, Xenomai use priority levels from 0 to 99. 99
> is the highest effective priority and 0 the lowest. 

To be precise, the Xenomai core can handle up to 258 priority levels
(0(lowest)-257(highest)). Within this range, skins/APIs set their own
sub-range, remapping levels internally to fit their specs. E.g. for
real-time threads, the native and posix skins use 1-99 , the VxWorks
skin uses 255-1, pSOS uses 1-255. All keep level 0 for special
Xenomai-enabled non-RT threads.

> But Linux uses levels from 0 to 139. For current task it uses levels
> 100 to 139 where 100 is highest priority than 139, and for "real time"
> threads 0 to 99 where 0 is highest than 99.s

SCHED_FIFO is 1-99 for static priorities. We are only interested in
remapping SCHED_FIFO and SCHED_RR over our priority scale. Other non-RT
scheduling classes managed by Linux are out of scope for Xenomai.

>  
> So when a task jumps in secondary modes is there a conversion of its
> own priority (100 - primary_mode_priority) or does she keep the same
> number.

SCHED_FIFO/SCHED_RR threads share the same priority scales both in Linux
and Xenomai domains.

> When two tasks with two different priorities are in secondary modes,
> is there a priority inversion between them or a crossed convertion of
> the priorities?

The priority of threads is not the issue. The issue here is that Linux
would run as the idle task of Xenomai, so a RT thread moving to
secondary mode - i.e. scheduled by Linux - would not compete anymore
with RT threads still scheduled by the Xenomai nucleus.

To work around this priority inversion, there is a mechanism to make the
Linux activity as a whole inherit the Xenomai priority of the Xenomai
thread which currently runs in secondary mode; it is enabled by default
(XENO_OPT_PRIOCPL). However, this mechanism only prevents a low-priority
Xenomai thread in primary mode from preempting a high-priority Xenomai
thread running in secondary mode; it does not give back all real-time
guarantees to the latter though.

> 
> Regards,
> 
> Charles
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.




      parent reply	other threads:[~2010-09-08 14:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-08 11:45 [Xenomai-help] question about priorities Charles Clerdan
2010-09-08 11:57 ` Gilles Chanteperdrix
2010-09-08 14:16 ` Stefan Kisdaroczi
2010-09-08 14:18 ` Philippe Gerum [this message]

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=1283955539.24088.55.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=charles.clerdan@domain.hid \
    --cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.