OpenEneaLinux / rt-tools

Collection of Linux tools for achieving real-time performance
BSD 3-Clause "New" or "Revised" License
32 stars 17 forks source link

Does partrt support isolating a thread on a core ? #10

Open chmike opened 2 years ago

chmike commented 2 years ago

I need to isolate a real time thread on a core of my Raspbian OS based on Debian bullseye.

Apparently the default controller type is domain which, if I understood correctly, allows to isolate processes only. I need to isolate a thread of a process that has 3 threads in total. Will partrt configure the cupset to support isolation of a thread on a core ?

Can I use the C affinity functions to move the thread to the isolated core ?

Is it still needed to set the priority of the thread to SCHED_FIFO 99 to get real time performance ? 

For the context, the thread is toggling GPIO outputs at very high frequency by writing directly into the Broadcom chip. There is no blocking call. There is only one system call to clock_gettime at low frequency (.5Hz) to measure the speed which is around 65Mhz.

matslil commented 8 months ago

Since this is a late answer I'm not sure how much of the above is still relevant... But if you use cgroup v1 (old version of Debian, not sure if Bullseye qualify for that), then you're first two questions would be a "yes".

As for real-time performance: If you have only one process on a single core, you'll get soft real-time performance which should be good enough for things like real-time audio processing. To get good real-time performance you also need to turn on tick-less support.

In either case, SCHED_FIFO shouldn't make much of a difference, since what it will do it so make sure it gets better priority than other processes on the same core.

Note that if you're response latency requirements are in the neighborhood of < 10ms or something, then I don't see why you would need CPU isolation even. The SCHED_FIFO should do the trick for you. But only testing will tell for real.