当前位置:网站首页>Principle and Technology of Virtual Memory
Principle and Technology of Virtual Memory
2022-08-05 02:46:00 【rainbow_lucky0106】
"Virtual memory" (virtual paging storage management scheme): a technical way of memory management that uses a portion of the hard disk space as a computer when the physical memory of the computer is not enough.memory to use.Virtual memory, as the name suggests, is a imaginary memory address space.
Principle: It is divided into multiple physical memory fragments, and some are temporarily stored on external disk storage for data exchange when needed.
How it works
The principle of program execution
The operating system gives each process the illusion that it has its own large amount of private memory, which can have a large contiguous address space to put its own code and data.The addresses accessed in the user program are virtual addresses, which need to be translated into physical addresses through the cooperative work of the operating system and the hardware to find the desired information.
Modern computer systems are equipped with high-speed random-access memory, called main memory, physical memory, or simply memory.Memory is the hardware used to store code and data. It is directly addressable storage space by the processor and fast access rate.The host entity of memory is usually Random Access Memory (RAM), and CPU can directly exchange data with RAM.In the working state of RAM, information can be written (stored) or read (taken out) from any specified address at any time.
The CPU usually generates a virtual address (VA) to access the main memory. Before this virtual address is loaded into the memory, it needs to look up the table and convert it into a physical address (PA), and finally the CPU indirectly accesses it.This physical address (PA) of memory.
Before the program is executed, it needs to be put in memory before it can be processed by the CPU.
When the program runs, it copies the program saved on the hard disk to RAM memory (load memory), and then CPU executes the program code in memory.Out of memory is caused by executing a program that uses a large or large amount of memory, or executing multiple programs at the same time.As a result, the program executes abnormally or crashes.
How virtual memory works
The address space of a process at runtime is actually a layer of logically abstracted contiguous addresses.When the process starts to run, a part of the program is loaded into the memory first, and the other part that does not need the actual physical memory temporarily stays in the external memory, and the actual physical memory is not allocated temporarily; when the instruction to be executed is not in the memory, and the system does the job of loading them into memory automatically.
(Memory Management: Automatic Swap Technology) When not enough memory, the system automatically selects part of the memory (programs not to be executed), and replaces the originalswapped to disk (hard disk) and frees the actual physical memory it occupies for use by other processes.The result of this is that the operation of the program is not affected at all, and the program feels that it has a virtual memory that is not constrained by memory capacity and can meet its own needs during operation.
- Page Replacement Algorithm: See "Operating System".
Virtual memory gives applications powerful capabilities, applications can create and destroy memory slices, applications can map memory slices to disk files, applications canShare memory with other processes.
Function
By running programs in lieu of some of the work of physical memory, the computer can run more programs and perform more tasks at the same time.
Virtual memory is not as simple as memory backup. In many cases, Win will use virtual memory to perform some specific operations to improve memory hit rate and system stability, especially for some memory-hungry ones.Software, such as Photoshop, 3Dmark, and some 3D games, also require virtual memory at runtime.
Disadvantages
But frequent swapping in and out is still a performance bottleneck.In order to reduce the impact of swapping in and out, increasing the available physical memory and increasing the access speed of external memory are two options.
Features
- Inexpensive, large capacity.Virtual memory is actually hard disk space, and the price of the same space is lower than that of physical memory.
- Inefficient operation.Hard disk transfers are much slower than memory transfers.
- Data loss after power outage.Like physical memory, after a sudden power failure, the data in virtual memory will be lost, and it does not have the function of saving hard disk (external memory) power failure.
System Space Settings
We can use the actual situation of the computer to continuously adjust and set the size of the virtual memory of the computer. If the setting is too small, it will not be enough. If the setting is too large, too many fragments will be generated, which will affect the running speed of the computer.
Recommendation: 1.5 to 3 times the actual physical memory of the computer.You can also let Windows automatically allocate and manage virtual memory, and it can dynamically adjust the size of virtual memory according to the actual memory usage.

How to set virtual memory in Win10?
How much virtual memory setting is appropriate for win10?This is the best setup!
边栏推荐
- The linear table lookup
- 1527. Patients suffering from a disease
- Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
- Introduction to SDC
- Error: Not a signal or slot declaration
- Multithreading (2)
- Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
- 汉字转拼音
- Simple description of linked list and simple implementation of code
- Snapback - same tree
猜你喜欢

Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail

How Jin Cang database correctness verification platform installation file

腾讯云【Hiflow】新时代自动化工具

继承关系下构造方法的访问特点

正则表达式,匹配中间的某一段字符串

C语言日记 9 if的3种语句

链表的简单描述及代码的简单实现

shell语句修改txt文件或者sh文件

lua学习
![Tencent Cloud [Hiflow] New Era Automation Tool](/img/ac/5c61424f22cd9fed74dcd529fdb6a4.png)
Tencent Cloud [Hiflow] New Era Automation Tool
随机推荐
数据增强Mixup原理与代码解读
北斗三号短报文终端露天矿山高边坡监测方案
How to transfer a single node of Youxuan database to a cluster
LeetCode使用最小花费爬楼梯----dp问题
tree table lookup
mysql can't Execute, please solve it
sql server 安装提示用户名不存在
【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?
Introduction to SDC
Ant Sword Advanced Module Development
Gantt chart is here, project management artifact, template is used directly
Open Source License Description LGPL
sql server installation prompts that the username does not exist
甘特图来啦,项目管理神器,模板直接用
1873. The special bonus calculation
View handler 踩坑记录
[ROS] (10) ROS Communication - Service Communication
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
Countdown to 2 days|Cloud native Meetup Guangzhou Station, waiting for you!
Industry case | insurance companies of the world's top 500 construction standards can be used to drive the business analysis system