A virtual memory has a page size of 32 words. There
are 16 pages and 8 blocks. The associative memory page table
contains the following entries
Page Block
a) For the following CPU addresses find the virtual addresses: B5,
2A (hex)
b) For the following virtual addresses find the CPU addresses: 1A9, 016, 149 (hex)
Page Block
0 3
4 5
7 2
9 4
12 0
13 1
14 6
15 7
Step 1 ;-
Data given is :-
Page Size = 32Words
Total Pages is 16
And Total blocks are 8
So, that means there is 2 pages in 1 block and it is 2 way associative
Offset bit will be = log 32 =5bits
Block address bits = log 8 = 3 bits
Virtual address Size = 16 * 32 = 512 words
Virtual address bits = log 512 = 9bits
and Outer page table address bits will be = 9 - ( 5 + 3 ) = 1 bit
Step 2 :-(a)
(1) CPU address given in Hexadecimal is = B5
In binary will be = 10110101
Where
Block address( 3 bits ) | Offset( 5 bits ) |
101 | 10101 |
In 5th block ( 101 ) there is 4th page present
So, Virtual address in binary 9bits is = 010010101 = 4th page in binary(4 bits ) + offset( 5 bits)
And In Hexadecimal will be = 095H
(2)
CPU address given in Hexadecimal is = 2A
In binary will be = 00101010
Where
Block address( 3 bits ) | Offset( 5 bits ) |
001 | 01010 |
In 1st block ( 001 ) there is 13th page present
So, Virtual address in binary 9bits is = 110101010 = 13th page in binary(4 bits ) + offset( 5 bits)
And In Hexadecimal will be = 1AA H
Step 3 :-(b)
(1) Virtual Address given in hexadecimal is =1A9 H
In Binary form 9 bits of virtual address is = 110101001
Where
Page Address ( 4bits) | Offset(5 bits ) |
1101 | 01001 |
In 13th page (1101) , there is 1st Block present
So,CPU address will be in binary ( 8 bits ) is = 00101001 =1st Block address ( 3bits ) + Offset in( 5bits )
CPU address in Hexadecimal = 29 H
(2)
Virtual Address given in hexadecimal is =016 H
In Binary form 9 bits of virtual address is = 000010110
Where
Page Address ( 4bits) | Offset(5 bits ) |
0000 | 10110 |
In 0th page (0000) , there is 3rd Block present
So,CPU address will be in binary ( 8 bits ) is = 01110110 =1st Block address ( 3bits ) + Offset in( 5bits )
CPU address in Hexadecimal = 76 H
(3)
Virtual Address given in hexadecimal is =149 H
In Binary form 9 bits of virtual address is = 101001001
Where
Page Address ( 4bits) | Offset(5 bits ) |
1010 | 01001 |
10th page (1010) is not present in any block as we can see in the table
So,There is a Page Fault
Get Answers For Free
Most questions answered within 1 hours.