Virtual addresses to physical address conversion process [turn]

Transfer: https://blog.csdn.net/yunfenglw/article/details/45603823

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https: //blog.csdn.net/yunfenglw/article/details/45603823
virtual addresses to physical address conversion process

2015-05-09 Qingdao Zhang Junhao 

Content in part from "Unix kernel source code analysis"

Software Environment: UNIX V6

Hardware Environment: PDP-11/40 (16-bit computers)

 

The second chapter "Process" describes a virtual address PDP-11/40 address the transformation process to a physical address.

 

 

 

MMU registers the virtual address into a physical address by APR (Active Page Register).

APR Register and a PDR (Page Description Register) is constituted by a register PAR (Page Address Register).

The kernel through to the implementation process corresponding to the process for the user to set the appropriate value APR used to ensure that each user has a separate virtual address space.

APR eight groups, APR [0] -APR [7]. Virtual address space of a process or a page segment is managed as a unit, corresponds to a set of APR. APR {PAR, PDR}, PAR base for storing information about the physical address of each page, PDR is used to save the pages of the block (64 bytes) and the number of whether to allow access to other information. Each page can be divided up into 128 blocks (8KB).

 

 

 

[Virtual address to physical address conversion process]: 3 upper bits of the virtual address corresponding to the determined page (APR), APR block 11-0 determines the bit physical address of the base address, the virtual address plus 12-6 bits obtained physical memory block address as the virtual address plus the value of the block offset bits 5-0, the final address is obtained. (~ Parsed below)

 

 

 

Above resolve the PDP-11/40 in the MMU virtual addresses to physical addresses of the transformation process, but we continue to think, why the processor to memory management uses the concept of "virtual address space", doing what good? Virtual formulate what is essentially?

1. The advantage of using a "virtual address space":

(1) manage the memory access. Virtual address different processes used in isolation from each other. If the program can directly access the physical address, also be able to access the physical memory area being used by another process, which may be other processes or operating system crashes. A process can not change the code in physical memory being used by another process.

(2) more efficient use of memory. By discontinuous regions of physical memory mapped into contiguous virtual memory area, the program can use a series of adjacent virtual address to access the physical memory is not adjacent (MMU complete corresponding mapping) of large memory buffers; can use a series of virtual address to access larger than the available physical memory of the memory buffer when the supply amount of hours of physical memory, the memory manager will be physical memory pages (usually the size of 4 KB) file is saved to disk, data or code pages are needed moves between physical memory and disk.

3) programming efficiency. Virtual addresses are relocatable program (ELF) implemented based on, for each program is a power of from 0 to 2 N (where N = 16) "virtual" memory, the MMU will be complete virtual address to a physical memory transformation ~ address

2. Adopt the nature of a "virtual address space":

Not so much virtual address, it would be better to say that the kernel program (code segment, data segment) provides a unified access model (abstract unified access mode) base-plus-offset (which is the memory of the hierarchical off page management ). The encoding of all programs begin programming you can start from the assumption of "0" base address, the base address of the specific operating system by setting the address conversion complete MMU ~

 

 


----------------
Disclaimer: This article is CSDN bloggers "Titan - Star 'original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/yunfenglw/article/details/45603823

Guess you like

Origin www.cnblogs.com/sky-heaven/p/11834820.html