当前位置:网站首页>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!
边栏推荐
猜你喜欢

金仓数据库如何验证安装文件平台正确性
![02 [Development Server Resource Module]](/img/60/f77ed0bb0e5654c9dcd70b73a5bee8.png)
02 [Development Server Resource Module]

Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium

QT MV\MVC结构

你要的七夕文案,已为您整理好!
![[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)](/img/ee/6b52072c841af99488dc0c1141c74c.png)
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)

01 【前言 基础使用 核心概念】

LeetCode uses the minimum cost to climb the stairs----dp problem

Gantt chart is here, project management artifact, template is used directly

select tag custom style
随机推荐
DAY23:命令执行&代码执行漏洞
C language diary 9 3 kinds of statements of if
SDC简介
[ROS](10)ROS通信 —— 服务(Service)通信
Syntax basics (variables, input and output, expressions and sequential statements)
sql server installation prompts that the username does not exist
The 2022 EdgeX China Challenge will be grandly opened on August 3
The 22-07-31 weeks summary
Chinese characters to Pinyin
undo问题
C语言实现简单猜数字游戏
C student management system head to add a student node
剑指offer专项突击版第20天
PostgreSQL数据库 用navicat 打开表结构的时候报错 cannot update secondarysnapshot during a parallel operation 怎么解决?
基于左序遍历的数据存储实践
[ROS] (10) ROS Communication - Service Communication
C语言日记 9 if的3种语句
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
How Jin Cang database correctness verification platform installation file
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1