Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Set process priority to "below normal" #565

Merged
merged 2 commits into from
Feb 1, 2019

Conversation

jakebailey
Copy link
Member

I'm submitting this since I had it sitting around. Let me know what you think.

This was suggested in #479. Doing this lowers the priority of the process to "below normal", which on UNIX-y systems is implemented as nice level 10. It may help yield CPU time to other things on the system if the analyzer is stuck somewhere using 100% of a core.

I checked the Roslyn analyzer after noticing it was set to below normal priority in my process list (see here), hence this PR. They additionally have the notion of a "user operation booster", which temporarily brings the process back to the normal priority, then back down again when disposed. Unfortunately, I don't believe this would work cross platform, as on UNIX-y systems users are not allowed to lower a nice value after increasing it without being root, even with processes they own, even to values that had previously been set.

I don't really like having to put this in Program.cs, as it'd be better served to be set after Initialize has occurred (and have it configurable), but that'd deprioritize the process during unit tests which I don't think is desirable. Perhaps enabling it when in release mode only would be a better choice.

A downside in general is that the CPU usage problem is going to be gone anyway as the old analysis that gets stuck won't exist. This would be a short-lived patch (which may or may not end up helping in the meantime).

@jakebailey jakebailey modified the milestones: Feb 2019.1, Jan 2019.2 Feb 1, 2019
@jakebailey jakebailey merged commit 7f5729a into microsoft:release Feb 1, 2019
@jakebailey jakebailey deleted the process-priority branch February 14, 2019 20:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants