Translation of logical and physical addresses in basic paging storage management mode

Source: Internet
Author: User
Tags numeric numeric value


The address structure of the analysis page storage management is one-dimensional, that is, the logical address (or physical address) is represented by only one numeric value. Given the logical address A, the size of the page is L, the page number p and the page address D can be evaluated as follows:

p=int [a/l]d=a MoD L

where int is the rounding function (the integer part of the numeric value), the MoD is the remainder function (the remainder part of the value is taken).



The purpose of a page table is to implement address mappings from page numbers to physical block numbers. Retrieves the page table with the page number of the logical address, obtains the physical block number of the page, and feeds the in-page address D directly into the in-block address field of the Physical address register. This allows the physical block number and the intra-block address to be spliced into the actual memory address, thus completing the conversion from the logical address to the physical address.

So the physical address is calculated as:

Physical Address = the size of the block (that is, the size of the page L)-block number f+ in the page address D



Example: In a paging storage management system, the page table for a job is shown below. If the page size is known to be 1024 bytes, try converting the logical address 1011,2148,4000,5012 to the corresponding physical address.

Page number

Block number

0

1

2

3

2

3

1

6



Jiuben, in order to describe the convenience, set the page number is P, the page displacement is D, then:

(1) For logical address 1011,p=int (1011/1024) =0,d=1011 mod 1024=1011. Page No. 0 on page 2nd, so the physical address is 1024′2+1011=3059.

(2) for logical address 2148,p=int (2148/1024) =2,d=2148 mod 1024=100. Page 2nd on page 1th, so the physical address is 1024+100=1124.

(3) For logical address 4000,p=int (4000/1024) =3,d=4000 mod 1024=928. Page 3rd on page 6th, so the physical address is 1024′6+928=7072.

(4) For logical address 5012,p=int (5012/1024) =4,d=5012 mod 1024=916. The logical address is illegal because the page number exceeds the page table length.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.