What is the 'virtual memory' mechanism that manages the memory of a computer?
When choosing a computer, you may have heard the opinion that 'more
An introduction to virtual memory-Internal Pointers
https://www.internalpointers.com/post/introduction-virtual-memory
Modern computers are generally equipped with RAM, which is the main memory, and HDDs and SSDs, which are the auxiliary storage devices, as storage media. HDDs and SSDs are suitable for storing large amounts of data, but they have the disadvantage that the read / write speed is too slow for the CPU to access them directly. RAM is a high-speed memory that mediates the exchange of data between the CPU and auxiliary storage device and resolves the speed difference.
RAM holds programs and data in units called memory addresses, and each memory address is given a number. The range of memory addresses where programs and data are stored is called address space, and it is explained that the CPU relies on memory addresses to read and write programs and data.
According to a
'Virtual memory' is a mechanism that allows users to program without worrying about the actual RAM address space by associating a virtual address with a physical address that is the actual RAM address. University of Illinois at Chicago of explanation according to, because the program has a separate virtual address space, that of that there is no need to worry about the arrangement of the physical address space for each program. Another advantage of virtual memory is that it solves the limitation of physical memory capacity.
In virtual memory, memory is linked in block units that are delimited by certain memory addresses. A block with a virtual address is called a page and a block with a physical address is called a frame. This page and frame are linked to each other in the form of a table, which is a page table. The CPU's
The MMU translates a virtual address to a physical address by referring to the information of the page to which the virtual address belongs and the in-page offset indicating where the target physical address is in the corresponding frame. A
Paging is the idea to secure RAM capacity by linking virtual addresses and physical addresses with not only RAM but also HDD and SSD. It is explained that the paging allows the OS to secure a larger virtual address space than the physical address space, and temporarily save programs and data to the auxiliary storage device when a page fault occurs.
However, when paging is used to hold programs and data in the auxiliary storage device, the program must be read from the auxiliary storage device, which has a slow read / write speed, into RAM, which reduces the OS read / write speed. Thrashing refers to the inability of an application to operate as a result of the computer's processing power being exhausted by the inability to allocate new frames due to lack of RAM, etc., and the constant page faults. According to the IT media 'IT Pro Today ', thrashing can be dealt with by increasing the RAM capacity and optimizing the page file size.
Virtual memory also protects memory between programs. Memory protection is typically done by the MMU, which causes invalid page faults such as segmentation and access violations when accessing virtual memory that the program does not own. The OS is said to protect the memory by receiving an invalid page fault notification from the MMU and exiting the program.
It is said that there are many things to consider when measuring the memory consumption of a computer, whether it is virtual or physical, and whether it is paged to auxiliary storage.
Related Posts: