Print Friendly and PDF
Paged memory management, on the one hand the actual physical memory (also called main memory) is divided into a number of fixed-size blocks of memory, called a physical page, or a page frame (page frame); on the other hand again CPU (including programmers) see the virtual address space is divided into equally sized blocks, called virtual pages, or simply page, page (page). Page size requirements are an integer power of 2, generally between 256 bytes to 4M bytes. In this book, the page size is set to 4KB. In 32 of 86x86, the virtual address space is 4GB, physical address space is 4GB, so in theory the program accessible to 1M 1M virtual pages and physical pages. Each physical page software can be placed in any place in the main memory, paging system (CPU and other hardware needed to provide the appropriate hardware support for paging mechanism, as described in the next section) provides a virtual address used in the program and the main memory dynamic mapping of physical addresses. So that when the program accesses a virtual address, paging mechanism supports automatic virtual address associated hardware CPU access the virtual address is split into page number (possibly multiple levels of page numbers) and page offset, then the page number is mapped to The page frame number, and finally add in the page offset to form a physical address, so that the final reading of the complete address / write / execute other operations.

Assume that the program is running while you read the contents of the address 0x100 to register 1 (represented by REG1), execute the following command:

mov 0x100, REG1 

Virtual address 0x100 is sent to the CPU's internal memory management unit (MMU), and MMU paging mechanism by supporting the relevant hardware logic would put the virtual address is located 0 virtual page which (set page size is 4KB), inside The offset is 0x100; and the operating system paging management subsystem has been set up the first virtual page 0 corresponds to the first two physical page frame, the start address of the physical page frame is 0x2000, then add the offset within the page Address 0x100, so the resulting physical address is 0x2100. Then MMU will put the real physical address is sent to the computer system address bus, which can access the correct physical memory unit.

If the operating system's paging management subsystem not provided with 0 corresponding virtual page physical page frame, then the first virtual page 0 There are currently no corresponding physical page frame, which causes CPU generates a page fault exceptions handled by the operating system page fault processing service routine to choose how to handle. If the page fault processing service routine that this is an illegal access, it reports an error, terminate the software running; if it is considered to be a reasonable access, it will use physical means of distribution, such as establishing the correct page page map, making it possible to re-correct Executive abnormal memory access instructions.
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: