The relationship between the page size, the page table entry, a virtual address and physical address (rpm)

 

 

From: https://www.cnblogs.com/0Nullptr/articles/6958964.html

 

First, the first clear several concepts 

Logical address: the program is compiled, the resulting object module is addressed from the start unit number 0 addressing, called relative address of the target module, is the logical address.

Page: The process of dividing the block, called the size of the corresponding page size.

Frames: dividing the memory block.

Both one-page and page frame, a page frame into one page, and the page size is equal to the size of the frames (theoretically) page.

Page Table: is the relationship between a page table and page frame one to one. [] Stored in the memory table index is just to play a role, it means energy can be found in a page and a page frame which corresponds to the relationship table.

Second, talk with examples [example appears in: "benevolent PubMed operating system" memory management]

Known conditions: 32-bit logical address, the page size of 4KB, the size of the page table entry 4B, byte addressing.

analysis:        

 1.

First 32-bit virtual address of the process can be represented by the size should be 2 ^ 32B = 4GB (temporarily not think about how many accounts page number P, W accounted for how many bits)            

2. (Definitions according to page size and page) the paging process:

3. We already know the number of pages is: 2 ^ 20. The point is that now confused on the issue of the page table entry.

The figure on the page table has been given of the number of data: 20, 12, 32, 2 ^ 20. [FIG on a data analysis of a requested binding] an explanation follows:

 

    2 ^ 20: because the role of the page table is the page of the page frame you want to tie it, so that each page should have a page table entry in the page table: This indicates a page number corresponding to a page frame number (block number memory), it should be     

                    This is 2 ^ 20. [There should be no problem, right, as if a class has 50 students, everyone should have a different address]

   20: Already it is clear that the need is shown 2 ^ 20 page table entries, 20 will need to address at least. Why take only 20 instead of 21, then 22, and now I have not thought about this problem, temporarily set at exactly 20 can take.

   32: Tell known conditions in the page table entry size 4B, so naturally it should be 32 a.

   12: 32 -20 = 12 bits. Why address page frame number is 12, can only represent 2 ^ 12 frames, to less than 2 ^ 20 pages of it, because each page is not to be transferred to the memory process. In fact, 32, 12, 20 three data still has some basis in the secondary page when you will find, "Oh, just fine." Two tabs not discuss here.

4. Through the above analysis we have come to what data:

   The logical address 32, the process size: 4GB.

   Page: The size of 4KB, number: 2 ^ 20.

   Page table entries: 4B, Quantity: 2 ^ 20. So we need space to store the page table 4B * 2 ^ 20 = 4MB of (this is the book, said: page table entry size for the origin of 4MB) Further, main memory page frames and page sizes are equal, but also for 4KB, so there will be a main memory page table will need to take up 4MB / 4KB = 1024 pages (because there is also a page table in the main memory, and main memory is divided by the page frame. this is really a waste of resources, so we need to create two page level, which is controlled within the size of one of the two pages can be stored in main memory)

 

 

 

 

 

 

 

 

 

 

 

-

Guess you like

Origin www.cnblogs.com/jiamian/p/12617248.html