4 ms·
Why aren't these changes the default? What are their drawbacks?
by slekker 3y ago
Why aren't these changes the default? What are their drawbacks?
- Tuna-Fish 3y agoGenerally, worse performance on throughput loads.
- michaelt 3y agoWhen a single-CPU system performs multi-tasking, switching between tasks is known as 'context switching' https://en.wikipedia.org/wiki/Context_switch https://en.wikipedia.org/wiki/Context_switch and it comes with a time cost. For example, the old process has its data in the CPU's fastest on-die cache, the new one doesn't - so it's initially slower. And the same thing can happen when switching back. For the lowest latency applications, there's also competition from "just dedicate a core to it full time" and "offload it to a dedicated microcontroller" lowering the demand to get it merged.
- pzmarzly 3y ago> just dedicate a core to it full time That's interesting, is there a place to read more about it? E.g. how to set it up on Linux and how much does it help with audio.
- michaelt 3y agoI've never done this myself, but as I understand it [1] you can choose certain cores that the OS scheduler doesn't schedule anything on, then you can manually assign processes to them. Assigning an entire CPU core to audio might be a bit much, unless you've got CPU cores to spare - the context in which I heard of this was high frequency trading, where the server really didn't need to do much except run this one application. [1] https://unix.stackexchange.com/a/530579 https://unix.stackexchange.com/a/530579
- Joeboy 3y agoI'd have thought most people doing serious audio work (recording live performances etc) would have a core to spare for the audio process. I suppose there's probably some reason this doesn't work well, because I've never seen anybody suggest it for linux audio. Or maybe it's just that low latency was "solved" by pre-emption or whatever when cores were a scarcer resource.
- hermitdev 3y agoThings to search for: CPU sets, core isolation. I work in trading, pretty much all of our performance sensitive apps use core isolation.
- dijit 3y agosame is true of gameservers for the serious AAA studios. On windows this sort of comes out of the box because windows always defaults CORE0 to the OS and is mostly single threaded, but you can set CPU affinity on your processes in process: just avoid core0. https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setprocessaffinitymask https://learn.microsoft.com/en-us/windows/win32/api/winbase/...
- csdvrx 3y agoI love windows, so when I moved to Linux I tried to replicate this on my Linux box I've found a lot of drivers like to spread their interrupts all over the place, so it's not as simple as using cpu affinity (or pinning processes) outside core 0 :(
- csdvrx 3y agoI've posted my configuration here, for an 12th gen intel alder lake P, both the kernel .config and the cmdline. Check the specs or ask GPT ("on many separate on-die cache does the 12th gen intel Alder Lake P i7 1270 has?") and you'll see it's simpler to think about it as having 3 groups of cores with different features because: - the 1st group has 4 performance cores each with their own L1 and L2: that's where I put the OS, with core 0 as usual and the other in NO_HZ, and the interrupts on power core 4 (here I'm using 0 and 4 to match what coretype reports P-CORE=0..7 that's due to hyperthreading) - then the next 2 groups have 4 efficiency cores each, sharing the L2 (The L3 is shared all over, so it doesn't matter) You could try to use my configuration as a base, and if it's not enough, you could try pinning the audio app on the power cores (obviously not 0 and 4 that are used, but like 1-3 and 5-7, which you could make tick if you prefer, you could also use more than 100 HZ depending on your needs) It will take you some experimentation, but as a fellow audiophile I'd be curious about the results it'd get you!