5 ms·
The best I've managed to achieve is by taking Linux off the real-time equation as much as possible : use isolcpu to tell Linux to not schedule processes on spec
by jcelerier 4y ago
The best I've managed to achieve is by taking Linux off the real-time equation as much as possible : use isolcpu to tell Linux to not schedule processes on specific cores, put them there yourself with pthread API, nice etc. You can also control on which core interrupts happen fairly easily. This gives you almost microcontroller-like access to some of your CPU cores.
- rramadass 4y agoNeat! Would be nice if you could add some more details to each of the points mentioned. As an example; 1) Do i need to configure "isolcpus" if i use "pthread_setaffinity" in my code directly ? 2) How do you do "interrupt affinity" in code ? PS: I found Red Hat's documentation for "real-time" useful: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_for_real_time/9 https://access.redhat.com/documentation/en-us/red_hat_enterp...
- jcelerier 4y ago> 1) Do i need to configure "isolcpus" if i use "pthread_setaffinity" in my code directly ? yes: isolcpus is there to tell the kernel : "never schedule anything on this CPU" ; pthread_setaffinity is then there to move your real-time process/thread on the now-isolated CPU. Maybe if you control the entire user space you could get the same result by manually calling pthread_setaffinity for every single thread, but that's very likley not what you want (and I'd guess the kernel would still do some periodic polling in this case which they won't on isolated cpus). But most the information I have comes from reading this exact guide which is very, very good and comprehensive :)