当前位置:网站首页>Principle and usage setting of large page memory
Principle and usage setting of large page memory
2022-07-29 01:07:00 【qq_ forty-two million five hundred and thirty-three thousand tw】
The principle of improving performance by the size of memory pages
First , We need to review a small part of the principles of computer composition , This is important for understanding large memory paging JVM Performance improvement is beneficial .
What is memory paging ?
We know ,CPU Memory is accessed through addressing .32 position CPU The addressing width of is 0~0xFFFFFFFF , The calculated size is 4G, In other words, the maximum supported physical memory is 4G.
But in practice , Encountered such a problem , The program needs to use 4G Memory , The available physical memory is less than 4G, Cause the program to have to reduce the memory consumption .
In order to solve such problems , modern CPU Introduced MMU(Memory Management Unit Memory management unit ).
MMU The core idea of is to use virtual address instead of physical address , namely CPU Use virtual addresses when addressing , from MMU Responsible for mapping virtual addresses to physical addresses .
MMU The introduction of , Solved the limitation of physical memory , For the program , It's like you're using it 4G Memory is the same .
paging (Paging) It's using MMU On the basis of , A memory management mechanism is proposed . It keeps the virtual address and physical address in a fixed size (4K) Split into pages (page) And page frames (page frame), And make sure the page is the same size as the page frame .
Such mechanism , In terms of data structure , Ensures efficient access to memory , And make OS Can support discontinuous memory allocation .
When the program memory is not enough , You can also transfer infrequently used physical memory pages to other storage devices , For example, disk. , This is the familiar virtual memory .
Mentioned above , Virtual address and physical address need to be mapped , Can we make CPU Normal work .
Mapping requires storing mapping tables . In modern times CPU Architecture , The mapping relationship is usually stored in physical memory, which is called a page table (page table) The place of .
Here's the picture :

From this picture , Can be seen clearly CPU And page table , The interaction between physical memory .
Further optimization , introduce TLB(Translation lookaside buffer, Page table register buffer )
It can be seen from the previous section that , Page tables are stored in memory . We know CPU Access memory via bus , It must be slower than directly accessing registers .
To further optimize performance , modern CPU Architecture introduces TLB, It is used to cache some frequently accessed page table contents .
Here's the picture :

contrast 9.6 That picture , Add... In the middle TLB.
Why support large memory paging ?
TLB It is limited. , There is no doubt about that . When exceeding TLB When the storage limit of , It will happen TLB miss, after ,OS Will command CPU To access the page table in memory . If it happens frequently TLB miss, The performance of the program will decline quickly .
In order to make TLB You can store more page address mapping relationships , Our approach is to increase the size of memory pages .
If a page 4M, Compare a page 4K, The former can make TLB More storage 1000 Page address mapping relationship , The performance improvement is considerable .
Set large page memory in virtual machine :
echo 1024 > /proc/sys/vm/nr_hugepages 2G Memory settings for 256,4G Memory settings 512.
边栏推荐
- Irregular clipping of NC data with CDO
- Educational Codeforces Round 132 (Rated for Div. 2)【A~C】
- B+ 树 ~
- 进程和线程知识点总结1
- JWT token related configuration (global configuration identity authentication rewrites authenticate method)
- 指令重排、happens-before、as-if-serial
- y80.第四章 Prometheus大厂监控体系及实战 -- kube-state-metrics组件介绍和监控扩展(十一)
- Wechat campus bathroom reservation for the finished product of applet graduation design (7) mid term inspection report
- 追踪伦敦银实时行情的方法
- “index [hotel/jXLK5MTYTU-jO9WzJNob4w] already exists“
猜你喜欢

Method of converting inline elements to block elements

Self made | a 16 bit RISC architecture CPU is self-made by hand

Deep learning | matlab implementation of TCN time convolution neural network spatialdropoutlayer parameter description

Wechat campus bathroom reservation applet graduation design finished product (5) assignment

How to carry out engineering implementation of DDD Domain Driven Design

Daniel guild Games: summary and future outlook of this year

State compression DP Mondrian's dream

mysql存储过程 实现创建一张表(复制原表的结构新建的表)
![[AD learning] the course of PCB drawing in this marine vehicle competition](/img/37/211a0557848f6922fda7a69a114923.png)
[AD learning] the course of PCB drawing in this marine vehicle competition

PLATO上线LAAS协议Elephant Swap,用户可借此获得溢价收益
随机推荐
What opportunities does the London gold real-time market bring?
Wechat campus bathroom reservation applet graduation design finished product (5) assignment
JWT token related configuration (global configuration identity authentication rewrites authenticate method)
Have you seen the management area decoupling architecture? Can help customers solve big problems
Method of converting inline elements to block elements
day8
【commons-lang3专题】005- ObjectUtils 专题
SQL Server 只有数据库文件,没有日志文件,恢复数据时报1813错误的解决方案
Machine learning | matlab implementation of RBF radial basis function neural network Newrbe parameter setting
机器学习 | MATLAB实现RBF径向基神经网络newrbe参数设定
SystemVerilog join and copy operators
Educational Codeforces Round 132 (Rated for Div. 2)【A~C】
UE4 common printing information methods for debugging
新拟态个人引导页源码
How to carry out engineering implementation of DDD Domain Driven Design
用CDO进行nc数据的不规则裁剪
Interview shock 69: is TCP reliable? Why?
iNFTnews | 元宇宙购物体验将成为吸引消费者的一大利器
小程序毕设作品之微信校园浴室预约小程序毕业设计成品(7)中期检查报告
Classification prediction | MATLAB realizes time series classification prediction of TCN time convolution neural network