xenomai.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* I need advice on thread scheduling policy.
@ 2022-10-21 12:21 Tamás Paál
  2022-10-21 16:43 ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Tamás Paál @ 2022-10-21 12:21 UTC (permalink / raw)
  To: xenomai

Dear All,

I am using Xenomai 3.2.1 and a Dovetail patched kernel on an x86 PC.

My application has about 30 threads. 3 of them are time critical. The
low priority threads are interact with the time critical ones, using
semaphores for data synchronization. The scheduling policy of these
time critical threads are SCHED_RR to be Xenomai threads. The others
are SCHED_OTHER so (in my understanding) handled by the Linux
scheduler.

Is this the right solution, or should I make all threads to be Xenomai threads?

What is the best practice to get the lowest latency for the time
critical threads? To get some load off of the Xenomai scheduler (by
removing the not time critical threads to Linux scheduler) or keep all
threads as Xenomai threads?

Thank you,
Tamas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: I need advice on thread scheduling policy.
  2022-10-21 12:21 I need advice on thread scheduling policy Tamás Paál
@ 2022-10-21 16:43 ` Jan Kiszka
  2022-10-22 17:16   ` Tamás Paál
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2022-10-21 16:43 UTC (permalink / raw)
  To: Tamás Paál, xenomai

On 21.10.22 14:21, Tamás Paál wrote:
> Dear All,
> 
> I am using Xenomai 3.2.1 and a Dovetail patched kernel on an x86 PC.
> 
> My application has about 30 threads. 3 of them are time critical. The
> low priority threads are interact with the time critical ones, using
> semaphores for data synchronization. The scheduling policy of these
> time critical threads are SCHED_RR to be Xenomai threads. The others
> are SCHED_OTHER so (in my understanding) handled by the Linux
> scheduler.
> 
> Is this the right solution, or should I make all threads to be Xenomai threads?
> 
> What is the best practice to get the lowest latency for the time
> critical threads? To get some load off of the Xenomai scheduler (by
> removing the not time critical threads to Linux scheduler) or keep all
> threads as Xenomai threads?

The best latency you generally get via
 - having RT threads on isolated cores, doing as little other stuff
   as possible there
 - using wait-free algorithms for the RT side to exchange data with the
   non-RT side

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: I need advice on thread scheduling policy.
  2022-10-21 16:43 ` Jan Kiszka
@ 2022-10-22 17:16   ` Tamás Paál
  0 siblings, 0 replies; 3+ messages in thread
From: Tamás Paál @ 2022-10-22 17:16 UTC (permalink / raw)
  To: xenomai

> On 21.10.22 14:21, Tamás Paál wrote:
> > Dear All,
> >
> > I am using Xenomai 3.2.1 and a Dovetail patched kernel on an x86 PC.
> >
> > My application has about 30 threads. 3 of them are time critical. The
> > low priority threads are interact with the time critical ones, using
> > semaphores for data synchronization. The scheduling policy of these
> > time critical threads are SCHED_RR to be Xenomai threads. The others
> > are SCHED_OTHER so (in my understanding) handled by the Linux
>> scheduler.
>>
>> Is this the right solution, or should I make all threads to be Xenomai threads?
> >
>> What is the best practice to get the lowest latency for the time
>> critical threads? To get some load off of the Xenomai scheduler (by
>> removing the not time critical threads to Linux scheduler) or keep all
>> threads as Xenomai threads?

> The best latency you generally get via
> - having RT threads on isolated cores, doing as little other stuff
>   as possible there
> - using wait-free algorithms for the RT side to exchange data with the
>  non-RT side

> Jan

Thank you for the fast response!
I have 6 CPU cores. I isolate Linux from the upper four using the
"isolcpus" kernel parameter.
I "move" the RT threads to the upper two cores via pthread_setaffinity.
I "move" the non-RT threads to the 3rd and 4th cores the same way.
The question was if I should keep the non-RT threads in the Linux
domain, or make them to be RT threads (by changing the scheduling
policy to SCHED_RR) ) with lower priority than the time critical RT
threads? The first might introduce interaction between Linux and
Xenomai, the second one puts more load on the Xenomai scheduler. Which
one is the better approach?
Thak you,
Tamas

Jan Kiszka <jan.kiszka@siemens.com> ezt írta (időpont: 2022. okt. 21.,
P, 18:43):
>
> On 21.10.22 14:21, Tamás Paál wrote:
> > Dear All,
> >
> > I am using Xenomai 3.2.1 and a Dovetail patched kernel on an x86 PC.
> >
> > My application has about 30 threads. 3 of them are time critical. The
> > low priority threads are interact with the time critical ones, using
> > semaphores for data synchronization. The scheduling policy of these
> > time critical threads are SCHED_RR to be Xenomai threads. The others
> > are SCHED_OTHER so (in my understanding) handled by the Linux
> > scheduler.
> >
> > Is this the right solution, or should I make all threads to be Xenomai threads?
> >
> > What is the best practice to get the lowest latency for the time
> > critical threads? To get some load off of the Xenomai scheduler (by
> > removing the not time critical threads to Linux scheduler) or keep all
> > threads as Xenomai threads?
>
> The best latency you generally get via
>  - having RT threads on isolated cores, doing as little other stuff
>    as possible there
>  - using wait-free algorithms for the RT side to exchange data with the
>    non-RT side
>
> Jan
>
> --
> Siemens AG, Technology
> Competence Center Embedded Linux
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-22 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 12:21 I need advice on thread scheduling policy Tamás Paál
2022-10-21 16:43 ` Jan Kiszka
2022-10-22 17:16   ` Tamás Paál

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 NNTP newsgroup(s).