Background
I am currently refactoring a legacy .NET application. The application performs complex mathematical computations over relatively long periods (up to a few hours), during which, periods occur of almost continuous processor usage on multiple threads.
Each user has an 8 core machine which is dedicated exclusively to running an instance of the application (they use other machines for running all other applications). The application is executed using a shared system account which allows support personnel, when required, to connect to the machine via Remote Desktop and monitor the application (this happens fairly often).
When the application process starts, it sets it’s own processor affinity is set such that the process is allowed to use all but one processor. E.g. on an 8 processor machine, the affinity is set to 0x007F (01111111) which limits the application to processors 1 to 7 and prevents it from executing any threads on processor 8. The excluded processor is always the one represented by the highest bit in the affinity value.
The justification for this is that exclusion of one processor allows the machine to remain more responsive when serving a Remote Desktop session and when using any other ad-hoc monitoring tools which may need to be used from time to time (Baretail, Process Explorer, etc.).
Question
Is this likely to yield much benefit given the cost of one CPU’s resources to the application?
Obviously I can perform some tests in order to gather empirical evidence, but test machine availability is limited and the behaviouir of the application has many external dependencies which means that the timing of the intensive processor usage is very difficult to determine. The time and resources required to benchmark this properly are likely to be far from trivial. For this reason I’m looking for theoretical reasons for or against doing this. To me, it seems like a bad idea since the application is prevented from using the resources of an entire CPU, which are unlikely to be fully consumed by other processes. I would like to remove the processor limitation and allow Windows to manage CPU allocation without restrictions. However, I need to be able to present some hard factsconvincing arguments in order to sell this change if, indeed, my suspicions are correct.
While I can’t offer a lot of hard facts about how you’re doing it right now, my immediate reaction is that you’re right, and the current approach you’re describing is wrong.
What I’d advise instead would be to reduce the execution priority of the long running process. In a typical situation, anything below normal will work about equally well. This lets the process use all available resources as long as nothing else needs them, but dedicates all necessary resources to other processes when/if needed.