10 points · by uptownhr · 9y ago · 12 comments
Why is it that you are not able to dedicate a core or a thread to your OS so, third party apps do not have access to them? This can prevent your entire OS from locking and your entire experience being jerky.
Adit has some good posts on concurrency:
—http://adit.io/posts/2013-05-11-The-Dining-Philosophers-Prob...
—http://adit.io/posts/2013-05-15-Locks,-Actors,-And-STM-In-Pi....
[0]: https://randomascii.wordpress.com/2017/07/09/24-core-cpu-and...
This can be rather annoying, especially if the machine is low on memory or swapping to death.
As a matter of design principle for a desktop machine, it should prioritize everything that I do.
That includes not stealing the keyboard focus when I'm typing, up to the point of rolling back any popups that opened just before I started to type.
The linux kernel is designed to be generic enough to work on wifi routers, phones, laptops, and massive compute clusters. There's some thing you can do, but there's going to be a class of optimizations any general purpose OS must give up on. For example, Windows NT runs a lot of window manager stuff in kernel space (https://en.wikipedia.org/wiki/Architecture_of_Windows_NT). Once you pull that in, the scheduler will have a richer dataset work with. But it kinda makes 32MB routers and headless servers less viable. Even Server Core still has a window manager!
That's a wholly separate issue. On Linux, at least, this is configurable to an extent, although I haven't used it recently enough to be helpful. Dedicated cores are irrelevant, though.
Without a hard real time guarantee from the hardware, everything built on it cannot provide a guarantee on dispatching only the exact amount of operations that the system can handle.
And that happens even before accounting that the os or some driver within may have some cpu locking going on.
On physical hardware I would use NUMA regions per set of applications as well to optimize the use of CPU cache and get lower latency to memory, but the overall memory availability will be reduced. This is done on some latency sensitive applications.
You can do similar things in Windows. There is probably a way in Mac, but I have never tried.
As others pointed out, there are many cases where doing all of this won't help, so it really depends on the problem you are trying to solve, or the optimization you wish to accomplish. There are certainly no one-size-fits-all solutions.
In my experience we used affinity with older CPUs to improve single thread performance. Recently it doesn't make much difference.
Why does CPU locking exist? I'm sure this is pretty technical question but if anyone has a dumb answer for me... Is this something impossible get rid of? Can it be scoped to a core and not the entire CPU?