All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Torsten Kröger" <t.kroeger@domain.hid>
To: xenomai@xenomai.org
Subject: Re: [Xenomai-help] POSIX Skin: Changing scheduling parameters ofthreads in other processes
Date: Thu, 9 Aug 2007 15:32:05 +0200	[thread overview]
Message-ID: <000a01c7da89$ada93230$c124a986@domain.hid> (raw)
In-Reply-To: <2ff1a98a0708090614u3b223ff4n196f0d5ed2a5db41@domain.hid>

>>>> this is my first email to this list, and I would like to start with
a
>>>> question. I use the posix skin of Xenomai 2.3.1, and I have several
>>>> processes running, each consisting of several threads. Is there a
>>>> possibility for a thread A1 running in process A to change the
>>>> scheduling parameters, in particular the priority, of a thread B1
>>>> running in process B?
>>>>
>>>> Regarding the posix specification I cannot find this functionality
>>>> there
>>>> and so I guess there is no way doing it with
>>>> "pthread_setschedparam()".
>>>> But is there another possibility?
>>>
>>>No, the only way you could do that is by using an IPC to pass the
>>>request from a process to another. You could use message queues for
>>>that.
>>>
>>
>> Thanks for this immediate answer. I just read some parts of the posix
>> specification, and if I'm not mistaking posix message queues do not
>> inherit thread priorities.
>
>My idea was that you could encode the request in a message that you
>would handle in the receiving process by receiving messages and
>calling pthread_setschedparam.

That was also one of my first ideas. But it won't be real-time-capable.
When a high-priority sender thread sends a message (using posix message
queues) to a low-priority receiver thread and blocks right after the
mq_send() call, then receiver thread should (immediately) get inherit
the high priority of the sender thread. But if there is any other
middle-priority thread in the ready queue, the scheduler would prefer
the middle-priority one instead of the receiver thread, which remains at
its low priority until it becomes scheduled. As result, we would have
the problem of priority inversion again, because the low-priority
receiver is supposed to work for the high-priority sender, i.e. it
should work with high priority.

So this won't work, I'd say.
 
>But then another problem arises: a pthread_t identifier is only valid
>in one process, so how could you designate in one process the threads
>of another process ?
>

I guess this is a general problem of the posix specification. As fare as
I know, there is no way to change the priority of a thread running in
another process. You would need something like SchedSet() from the
QNX-OS. Here you can specify a process ID and a thread ID in order to
change the thread's scheduling parameters.


Best regards and thanks for your _fast_ help again,
Torsten



  reply	other threads:[~2007-08-09 13:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2979.1186650741.22887.xenomai@xenomai.org>
2007-08-09  9:41 ` [Xenomai-help] POSIX Skin: Changing scheduling parameters of threads in other processes Torsten Kröger
2007-08-09 10:33   ` Gilles Chanteperdrix
2007-08-09 13:06     ` [Xenomai-help] POSIX Skin: Changing scheduling parameters ofthreads " Torsten Kröger
2007-08-09 13:14       ` Gilles Chanteperdrix
2007-08-09 13:32         ` Torsten Kröger [this message]
2007-08-09 13:51           ` Gilles Chanteperdrix
2007-08-09 14:27             ` Torsten Kröger
2007-08-09 14:18       ` Philippe Gerum
2007-08-09 18:37         ` [Xenomai-help] POSIX Skin: Changing scheduling parameters of threads " Torsten Kröger

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='000a01c7da89$ada93230$c124a986@domain.hid' \
    --to=t.kroeger@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.