microsoft / microsoft/WSL

WSL2 set priority for WSL distro (wmmemWSL) in .wslconfig

Open
#10,136 1 comment 3 reactions 0 assignees View on GitHub
feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

**Is your feature request related to a problem? Please describe.**
When running CPU intensive tasks/program in WSL (multithreaded), it can take all the CPU resources of the system and slow down everything, even outside of WSL2.
While it is possible to assign less cores to a WSL distro than there are on the system, there are cases where we still want all the cores in the WSL distro so that we can test/run those programs on all the logical cores. But at the same time, we'd still like Windows to have priority to access the CPU (so that Windows is still usable).

**Describe the solution you'd like**
It would be nice to be able to choose per the preferred priority so that it automatically sets the vmnemWSL priority to the preferred one every time the WSL distro starts (when you reboot your computer or other).
One great way of doing it would be to add a config variable in .wslconfig where one could set the priority desired for the WSL distro.
Example:
```
[wsl2]
priority=Low
```
This would start all WLS2 distro with the Low priority.
Possibles values would be the same as what is in the task manager: Low, Below normal, Normal, Above Normal, High, Realtime

**Describe alternatives you've considered**
Alternative is to manually change the priority of the vmnemWSL process via the task manager. It works, but most of the time, forget to do it.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Research direction

Review the proposed .wslconfig priority setting and the vmnemWSL process behavior described in the issue, using Task Manager's priority choices as the reference. Done means WSL2 applies the selected priority automatically whenever the distro starts and supports the requested priority values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.