Converter o endereço virtual para o endereço físico [fechado]
Suponha que temos 28 bits de espaço de endereçamento virtual e 32 bits de espaço de endereçamento físico. E o tamanho da moldura é 1kb. Quero converter o endereço virtual {[[0]} para um endereço físico.
[a minha tentativa] 1kb = 1024byte = 2^10
por isso o número da página virtual é 0x0000
e a compensação é 0x39A
. Nesta tabela de páginas, 0x00
tem 0x0100
número físico da página. Então eu pensei que o número do endereço físico era 0x010039A
mas a resposta é 0x0004039A
. Alguém pode explicar isto ?
0
Author: RecklessSerenade, 2018-06-25
1 answers
Vamos fazê-lo passo a passo, mesmo que as respostas aqui possam ter-te ajudado a fazê-lo tu mesmo.
__________
| STEP 1 |
¯¯¯¯¯¯¯¯¯¯
0x000039A is in virtual, lets convert it to binary representation
0b 0000 0000 0000 0000 0011 1001 1010
0x 0 0 0 0 3 9 A
__________
| STEP 2 |
¯¯¯¯¯¯¯¯¯¯
Calculate the number of bits needed to reference the whole 1KB
1K = 2^10
==> 10 bits are needed. Just do log2(page-size).
__________
| STEP 3 |
¯¯¯¯¯¯¯¯¯¯
Take away the first 10 bits of the binary presentation
0b 0000 0000 0000 0000 0011 1001 1010
offset = 0b 11 1001 1010
= 0x 3 9 A
__________
| STEP 4 |
¯¯¯¯¯¯¯¯¯¯
Get the virtual page out of what ever bits left
0b (00)(00 00)(00 00)(00 00)(00 00)
= 0x00000
__________
| STEP 5 |
¯¯¯¯¯¯¯¯¯¯
Go to the page table at the entry 0x00000, there you will find the corresponding frame number.
Suppose the page table is given:
________________
| 0x0 | 0x0100 |
| 0x1 | 0xA |
| . | |
| . | |
| | |
----------------
__________
| STEP 6 |
¯¯¯¯¯¯¯¯¯¯
Turn the frame number to binary representation and concatenate it to the offset
Frame | offset
0x0100 |
0b (00)(00 00)(01 00)(00 00)(00 | 11) (1001) (1010)
0x 004039A
0
Author: Tony Tannous, 2018-06-25 16:03:08