Debian – How to run real-time application in Linux

debianreal time

Trying to get working LinuxCNC on my Debian Jessie, I did:

  • Installed the kernel 4.9 RT through Jessie backport using apt-get/aptitude.
  • Restarted my computer and checked uname -a contain PREEMPT RT
  • Installed LinuxCNC by adding the repository and using apt-get

After that, starting the linuxCNC wizard (by normal clicks through menus) there is a jitter test. My current results are absolutely bad, around 140us.

I wonder if there is any PREEMPTION configuration to enable, or specific way to run an application to get more precise real-time?

Also, how could I check that the process is running real-time?

Note: My computer is an intel E6600

Best Answer

I wonder if there is any PREEMPTION configuration to enable, or specific way to run an application to get more precise real-time?

See the following:

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Latency-Test

which links to this:

https://forum.linuxcnc.org/18-computer/25927-reducing-latency-on-multicore-pc-s-success?limitstart=0

(from the above page:)

Linux related changes:

  • edit /etc/default/grub and add the kernel options: "isolcpus=1 acpi_irq_nobalance noirqbalance" (call update-grub afterwards)
  • make sure that the software "irqbalance" is NOT installed, remove if it is there (Ubuntu software center -> installed software -> search for irqbalance -> remove)
  • add the upstart script "irq-affinity.conf" to /etc/init (see attachments, it will move the irq-handling to the first core)
  • add the sh scripts set-irq-affinity and watchirqs to /usr/local/sbin (first allows to set the affinity mask manually, second opens a console window that shows live how the irqs are scheduled to the different cores -> all numeric irqs but 0 should be handled by cpu0)

You might have to adapt the script for Système D, though ...

A quick thing to test: You could also up the priority with nice -n <x>, where <x> is the desired priority.

Also, how could I check that the process is running real-time?

See this question: Real time processes scheduling in Linux