many words and forum page have been written over the years about this topic and how to reduce the xruns. I want to share my new discovery of last days, since I’ve not read about it on the forums.
Long story short: I have a linux opensuse system with all the recommended settings (realtime kernel, limits.conf, IRQ setup, and etc etc…), usb audio card, and I was not able to go below 8 ms of latency (from qjackctl) without occasional xruns.
The new thing is that the Ardour GUI have a role: when I record with the GUI in background (let’s say minimized), no XRUN appears even with a latency < 5ms. Impressive and unexpected behaviour.
I think that the GUI redraw process during the recording (vmeter? timers? waveform draw?) uses some CPU process with the highest priority (realtime?) and causes xruns.
I would suggest to make a test by yourself, trying to put the ardour in background during recording session and check if you have fewer xrun.
Waiting for your feedback.
That sounds like a graphics driver issue. perhaps the driver you use is not preemptive and/or the graphics card shares an interrupt with the soundcard.
Can other graphic applications cause x-runs, tool? eg.switching desktops, scrolling web-pages using google-maps etc.
In any case, it rather sounds like something specific to your system.
Only switching desktop doesnt’ cause xrun… but yes, probably the graphic driver can play a role.
Anyway, what I wrote can be a workaround (since change a graphic driver usually is not a easy job…)
I have a similar issue with Renoise, which is described here: https://forum.renoise.com/t/bad-performance-without-compositing-linux/56770
It does not occur when I use a compositor like compton, which normally should increase CPU usage, but it does not in my case.