Collection
zero Useful+1
zero

paging

Memory management technology in operating system
paging (English: Paging) operating system in Memory management A technology of Main storage You can use the Auxiliary memory Data in. The operating system will convert the auxiliary storage (usually disk )The data in is partitioned into fixed size blocks called "pages". When it is not needed, paging is performed from main memory (usually Memory )Move to Auxiliary memory When necessary, the data is retrieved and loaded into main memory. be relative to subsection Paging allows storage to be stored in discontinuous blocks to keep the file system tidy. Paging is the smallest unit for transferring data blocks between disk and memory.
Chinese name
paging
Foreign name
Paging
Definition
one kind operating system in Memory management Technology of
Nature
Minimum unit of data block transferred between disk and memory
Discipline
computer
Field
computer

brief introduction

Announce
edit
paging (English: Paging) operating system in Memory management A technology of Main storage You can use the Auxiliary memory Data in. The operating system will convert the auxiliary storage (usually disk )The data in is partitioned into fixed size blocks called "pages". When it is not needed, paging is performed from main memory (usually Memory )Move to Auxiliary memory When necessary, the data is retrieved and loaded into main memory. be relative to subsection Paging allows storage to be stored in discontinuous blocks to keep the file system tidy. Paging is the smallest unit for transferring data blocks between disk and memory.
Paging/Virtual Memory It can help greatly reduce the overall and additional unnecessary I/O times, and improve the overall operating performance of the system. Because it can help improve the read hit rate of RAM, and also achieve the pre caching of I/O data streams through its internal efficient algorithms. It can also improve the utilization efficiency of CPU through related means, and users with large physical memory are more likely to consider using such methods as Ramdisk Supercache SoftPerfect RAM Disk And simulate the hard disk partition to set the virtual memory/system temporary files on it at the same time to further enhance the system performance and achieve the measures to guarantee the hard disk. Pagination is virtual memory An important part of technology.

overview

Announce
edit
Paging is when data is not mapped Random access memory The operating system must control the actions that will be taken to make the program continue to run. Generally speaking, the operating system will put the data of the running program into the frame above the random access memory and clear the unnecessary data from the frame. However, if the random access memory has no empty frame available, the operating system will save part of the data back to the auxiliary memory and then release it. The auxiliary memory will use paging to store the files on the pages with the average allocated size, and then write them back when the random access memory needs to be used. If the data needs to be updated after the random access memory releases the data, the system must write the data back first and then update it, and then store it in the auxiliary memory. High performance systems need to spend less time replacing data on RAM, so general systems will adopt Least recently used algorithm (LRU) to achieve high effect.

Hit and page fault

Announce
edit
Since it was invented earlier (in the early 1960s) CPU - storage Between SRAM Cache, Virtual memory The system uses different terms. [1]
  • In the virtual memory system, DRAM Cache hit is the process of reading an address in the DRAM cache. The hit process does not require the program to disk Read data slowly in.
  • Relatively, a DRAM miss is called a page fault. Because page frames are created by Significant bit and Physical page number (or disk address). When the significant bit is marked as 0, it means that the address is not in the cache. Calling the address will cause a page fault exception, thus copying the required content from the disk, overwriting one of the cache Sacrifice Page , so that it can hit. Too many page faults will lead to repeated disk reads and writes, which is very time-consuming.

System turbulence

Announce
edit
Although the total number of different pages referenced by the program (that is, the virtual memory size) may exceed Physical storage (DRAM), but programs are often active on smaller active pages. This set is called working set or resident set. After the working set is cached, repeated calls to it will improve the hit rate of the program, thus improving the performance. [1]
Most programs can reach a stable state during data acquisition and reading in the memory. When the program reaches a stable state, the memory usage is usually not too large. Although virtual memory can efficiently Control memory But solve a lot of problems Page missing It is also the main factor causing system delay. When the size of the working set exceeds the size of the physical memory, an unfortunate situation will occur in the program. This situation is called "Thrashing". Pages will be constantly written, released, and read. Due to a large number of losses (rather than hits), great performance will be lost. Users can add Random access memory It can reduce the probability of system turbulence by reducing the number of programs running in the system at the same time.

Page scheduling

Announce
edit
  • When data is needed, it requests the system to transfer data from auxiliary storage to storage. This is called“ demand paging ”。 It makes the system do not need to put all the programs on the memory, reducing the amount of memory required. All modern systems use on-demand paging.
  • When the system looks at the paging table and thinks that some data may be needed, the act of first transferring the data to the memory is called“ Advance pagination ”When the memory is large enough, this method is usually adopted.
  • Unix The system will be used regularly sync The program will clean all the changed frames, and it will save all the changed frames to the auxiliary memory. Windows The system sometimes performs operations with similar functions, which can make new programs open faster.

share

Announce
edit
stay Multitasking or Multi user In this environment, we often encounter different programs that need the same data. If we use individual processing, a lot of memory will be wasted. Shared functions enable different programs to use the same memory. It should also be noted that the system must separate the modified data to prevent other programs from using the modified data.

realization

Announce
edit

Ferranti Atlas

The first computer supporting the paging system is Atlas, which has 250 word paging partitions Combined storage

Windows 3. X and 9x

Microsoft In order to make the Windows 3.x Not like Windows 1.0 or Windows 2.0 It also requires a lot of hardware resources, so the paging system is added to Microsoft Windows Inside. The system will create 386SPART PAR or WIN386.SWP hidden files to exchange files with storage, usually in root directory Sometimes it will be generated in the WINDOWS folder. The size of this file determines the size of the page file (which can be control panel If the user moves or deletes this file, it will appear at the next boot Blue screen crashes

Windows NT

stay Windows NT In the system (e.g Windows XP Vista seven eight The page file is named pagefile.sys and stored in the root directory. Sometimes in boot sector There will be a system crash and Memory dump The Windows system will use the paging file as temporary storage and free up the paging file space when the system is restarted next time.

Unix and Unix like systems

stay Unix And class Unix system In, the system will regularly update the data between the random access memory and the virtual memory. Some systems will draw a special block on the hard disk as a page file exchange file, called swap partitions. Some systems can also use this block as a file.
stay Linux In core 2.6 and above, because the system can directly bypass other programs and directly exchange partitions in the form of files, partition files can already be as fast as swap partitions, and partition files can be automatically stored in the most frequently read places on the hard disk, but red hat It is still recommended to divide the hard disk into special blocks for use. However, the file partition is flexible and can be freely stored on any disk and changed to any size. The location and size cannot be changed unless special tools are used after the hard disk is divided into special blocks. Linux can create countless partitions and prioritize files. The more frequently the hard disk is read, the more priority the system will give to the partition. Therefore, it is necessary to carefully prioritize the partitions, otherwise the system performance will be greatly reduced.
OS X Multiple partition files are used. Although they can be saved elsewhere, they are saved to the root directory of the hard disk by default.

32-bit hardware limitation

Announce
edit
Due to 32-bit hardware Address bus The address can only be located to 4GB at most, and the part beyond the address cannot be paged by the computer to use memory.