当前位置:网站首页>[wsl2] restrict wsl2 accessible hardware resources (cpu/ memory)
[wsl2] restrict wsl2 accessible hardware resources (cpu/ memory)
2022-06-13 01:32:00 【Ryan ZHENG】
WSL2 Theoretically available Windows All managed within the system CPU、 Memory resources ;
But that brings a problem , namely :
Sometimes we use WSL2 Just as a terminal window , Not too much CPU Or memory , But because of Linux Kernel memory management mechanism , It will try to cache some file pages that have been read , It will not be released for a long time . And this part of the file page will not be Windows Recycling , Lead to WSL2 Taking up too much memory , and Windows Instead, there is no memory available ;
For this scenario , Can be in %UserProfile% Next create a .wslconfig File to configure :
(%UserProfile% Usually C:\Users<$username>\)
[wsl2]
processors=4
memory=4GB
swap=4GB
- processors As the name suggests, it means to limit CPU The core number ( Will be reflected in /proc/cpuinfo On equal nodes )
- memory Is the total available memory size ( Will be reflected in /proc/meminfo On equal nodes )
- swap Is the total size of the swap space ( Will be reflected in /proc/meminfo On equal nodes )
Save your changes and close WSL, And reopen the window to start :wsl --shutdown Ubuntu
Look at the nodes , In force :
ryan /mnt/c/Users/ryan $ cat /proc/cpuinfo | grep processors
ryan /mnt/c/Users/ryan $ cat /proc/cpuinfo | grep processor
processor : 0
processor : 1
processor : 2
processor : 3
ryan /mnt/c/Users/ryan $ cat /proc/meminfo | grep Total
MemTotal: 4028148 kB
SwapTotal: 4194304 kB
VmallocTotal: 34359738367 kB
HugePages_Total: 0
边栏推荐
- Facial expression recognition dataset
- Project training (XVII) -- personal work summary
- Realization of flip animation
- Leetcode-18- sum of four numbers (medium)
- Docker install MySQL
- Logical operation bit operation
- Differences among bio, NiO and AIO
- Downloading wiki corpus and aligning with multilingual wikis
- Leetcode 05 tree
- Copy (copy) constructors and assignment overloaded operators=
猜你喜欢

Project training (XVII) -- personal work summary

The tle4253gs is a monolithic integrated low dropout tracking regulator in a small pg-dso-8 package.

Jenkins continuous integration operation

Uuid/guid introduction, generation rules and generation codes

Deadlock problem summary

Application advantages of 5g industrial gateway in coal industry

MySQL performance optimization
![[Stanford Jiwang cs144 project] lab1: streamreassembler](/img/7b/fad18b68a6ee30d1dec4dad6273b98.png)
[Stanford Jiwang cs144 project] lab1: streamreassembler

Realization of flip animation

URI, URL and urn difference, relation and syntax diagram
随机推荐
My crawler learning notes
Minimum score of one question per day
V-inline-date, similar to Ctrip, flying pig, time selection with price
Wikipedia API User Guide
4K sea bottom and water surface fabrication method and ocean bump displacement texture Download
Transaction characteristics and isolation levels
Differences among bio, NiO and AIO
What kind of experience is it to be a software test engineer in a state-owned enterprise: every day is like a war
Project training (XVII) -- personal work summary
Introduction to common activation functions
FSOs forest simulation optimization model learning notes
ArrayList underlying source code
About the proposed signature file migration to industry standard format pkcs12
[Stanford Jiwang cs144 project] lab1: streamreassembler
H5 open the app. If the app is not downloaded, jump to the download page. If the app has been downloaded, wake up the app
leetode. 242. valid Letter heteronyms
关于#数据库#的问题,如何解决?
Leetcode-17- letter combination of phone number (medium)
MySQL related summary
leetcode. 349. intersection of two arrays