Physical memory, virtual memory, buffers, cached, shared memory, swap

Physical memory:

Actual memory used;

 

Virtual Memory:

Virtual memory is a logical memory space concept carefully designed by the operating system kernel to manage the process address space (process address space management). The pointers in our program are actually addresses in this virtual memory space. For example, we need to use g++ to compile after writing a C++ program. At this time, the address used by the compiler is actually the address of the virtual memory space. Because the program is not running at this time, what about the physical memory space address? All instructions or data that may be needed during program operation must be in the virtual memory space . Since virtual memory is a logical (imaginary) memory space, in order to allow programs to run on a physical machine, there must be a mechanism that allows these imaginary virtual memory spaces to be mapped to physical memory spaces (real and real RAM memory stick space). This is actually what the page table in the operating system does. The kernel maintains a separate page mapping table for each process in the system . The basic principle of the page mapping table is to map a section of virtual memory space that needs to be accessed during the running of the program to a section of physical memory space through the page mapping table, so that when the CPU accesses the corresponding virtual memory address, it can look up the page mapping table through this The mechanism accesses a corresponding address in physical memory. "Page" is the basic unit of mapping virtual memory space to physical memory space.

 

Shared memory:

The part of memory shared between multiple processes, such as the public library libc.so, etc.

 

Swap partition, interactive memory:

The interactive partition belongs to the hard disk space and is used as a temporary memory when the memory is insufficient

The main function of swap is that when the physical memory is not enough, some programs in the memory will be temporarily moved to swap, so that the physical memory can be used by the programs that need it. In addition, if your host supports the power management mode, that is, if your Linux host system can enter the "sleep" mode, then the status of the running program will be recorded to swap as a "wake up" host State basis! In addition, some programs will use the characteristics of swap to store some data segments when they are running, so swap needs to be created! It just doesn't need to be too big!

Buffer is the data that will be cached on the hard disk

Cache is to cache the data read from the hard disk

 

A buffer is something that has yet to be "written" to disk. A cache is something that has been "read" from the disk and stored for later use.

 

From: http://blog.csdn.net/rebirthme/article/details/50402082

http://blog.51cto.com/frankch/1862697

Reprinted at: https://www.cnblogs.com/shengulong/p/8418340.html

Guess you like

Origin blog.csdn.net/qq_32907195/article/details/112555080