Question type 2 : address translation
There are two types of address translation : Basic address conversion mechanism and address conversion mechanism with fast table . The speedometer is a little complicated , The teacher won't be difficult for us , In previous years, the questions were all about basic address translation , I will only explain the former here .
The following parameters mainly appear in this type of questions : Number of pages in user programming space , Size per page ( Page length ), Size of main memory ( Size of memory space ), Virtual page number ( Empty page ), Physical block number ( Page box )
This type of question is mainly 3 ask :1, Determine whether a virtual address is missing pages during the conversion process
2, Find the physical address corresponding to the virtual address
3, Draw the address translation process
Let's look directly at an example :
example 1: stay ⼀ Paged virtual storage systems ,⽤ User programming space is 32 Pages , Page size is 1 KB, Memory space is 16 KB. If known
Virtual page number physical block number
04
17
28
310
(1), Judge virtual address 0AC5(H) Whether pages are missing during conversion .
(2), If no page is missing , Virtual address 0AC5(H) Convert to corresponding physical address .
(3), Draw the address translation process
solution :
(1) By table
2-16 Binary conversion table
01234
00000001001000110100
56789
01010110011110001001
A(10)B(11)C(12)D(13)E(14)F(15)
101010111100110111101111
take 0AC5H Convert to binary , have to :0000 1010 1100 0101
Page size 1 KB = 2^10 , After description 10 position ( purple ) surface ⽰ Is an in page offset address
Number of pages 32 = 2^5, The first five digits of the offset address in the description page ( red ) Is the page number address
Take out the page number and address separately 00010 Convert to 10 Base , The page number address is 2
because 2 Exists in the virtual page number given in the question (0,1,2,3) in , So there are no missing pages .
(2)
From the previous question 0AC5H Page number address of is 2, From the table on the middle page of the question 0AC5H The corresponding physical block number is 8
Set physical block number 8, switching sites , have to 01000( notes : Number of bits converted from physical block number to binary =Log2( Memory space size / Page size ))
Turn the orange 01000 Replace 0000 1010 1100 0101 Red part of , have to 0010 0010 1100 0101, Zaijiang 0010 0010 1100
0101 Convert to 16 Base 22C5H, Is the required virtual address 0AC5(H) Convert to corresponding physical address
(3) Just imitate the painting
be careful : Sometimes the logical address given in the title is 10 Base , Let's convert it into binary and continue , Step unchanged .
example 2: User programming space of a virtual memory 32 Pages , Each page is 2kB, Memory is 16kB. Assume that the comparison table of page numbers and physical block numbers of pages that have been transferred into memory in a user's page table at a certain time is as follows :
Page number Physical block number
0 5
1 10
2 4
3 7
Then logical address 1A5C(H) What is the corresponding physical address
solution :
The logical address of page storage management is divided into two parts : Page number and in page address . By known conditions “ User programming space total 32 Pages ”, It can be seen that the part of page number accounts for 5 position , from “ Each page is 2KB”, It is known that the address in the page accounts for 11 position . from “ Memory is 16KB, Page size is 2KB”, knowable Log2(16kb/2kb)=3, Block number is 3 position .
Logical address 1A5C(H) The corresponding binary representation is :0001 1(010 0101 1100) , According to the above analysis ,() Inside is the address on the page , code “0001
1” Is page number , Indicates that the page number corresponding to the logical address is 3. Page lookup table , Get the physical block number is 7( decimal system ), That is, the physical block address is :0011 1 , Address in splicing page 010 0101
1100, have to 0011 1010 0101 1100, Namely 3A5C(H).
thank you “ Green peach and dew ”5 month 22 You gave it to me 8 Gross money
thank you “qq_52937762”5 month 23 You gave it to me 1.6 element
Technology
Daily Recommendation