Have you ever experience your mouse and keyboard input start to lag?<p>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.
Mostly because the os needs to coordinate everything and not all operations can be interrupted. Operating system maintain each program illusion to be alone on the hardware, virtualizing disk transfers, memory mappings, display regions and all the other hardware. Some operations once queued and dispatched need to complete before other operations can be accepted - that might happen for example when the os is figthing to access a memory page from disk but the disk is busy in a large dma transfer - then the illusion of being alone comes crashing down and no clever scheduling can fix it, because a class of operations without a guaranteed time constraint exist on the ibm pc platform.<p>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.<p>And that happens even before accounting that the os or some driver within may have some cpu locking going on.
This isn't specific to your question, but I have VM's that have 6 logical processors. I use taskset to set the affinity of all OS processes to logical proccesor 0. This doesn't work for some kernel threads, but it works for most processes. I then give haproxy a number of logical processors, or balance based on what is running on that VM.<p>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.<p>You can do similar things in Windows. There is probably a way in Mac, but I have never tried.<p>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.
<a href="https://en.wikipedia.org/wiki/Processor_affinity" rel="nofollow">https://en.wikipedia.org/wiki/Processor_affinity</a><p>In my experience we used affinity with older CPUs to improve single thread performance. Recently it doesn't make much difference.
Feels like there isn't a solution using current OSes.<p>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?