SlideShare a Scribd company logo
1 of 6
Download to read offline
Virtual Memory Examples
Problem 1:
This problem concerns the way virtual addresses are translated into physical ad-
dresses. Imagine a system has the following parameters:

    




       Virtual addresses are 20 bits wide.
    




       Physical addresses are 18 bits wide.
    




       The page size is 1024 bytes.
    




       The TLB is 2-way set associative with 16 total entries.

The contents of the TLB and the first 32 entries of the page table are shown as
follows. All numbers are given in hexadecimal.

                TLB                               Page Table
  Index      Tag PPN       Valid          VPN PPN Valid VPN PPN Valid
    0        03     C3      1             000  71  1    010  60  0
             01     71      0             001  28  1    011  57  0
       1     00     28      1             002  93  1    012  68  1
             01     35      1             003 AB   0    013  30  1
       2     02     68      1             004 D6   0    014 0D   0
             3A     F1      0             005  53  1    015 2B   0
       3     03     12      1             006  1F  1    016  9F  0
             02     30      1             007  80  1    017  62  0
       4     7F     05      0             008  02  0    018 C3   1
             01     A1      0             009  35  1    019  04  0
       5     00     53      1             00A 41   0    01A F1   1
             03     4E      1             00B 86   1    01B 12   1
       6     1B     34      0             00C A1   1    01C 30   0
             00     1F      1             00D D5   1    01D 4E   1
       7     03     38      1             00E 8E   0    01E 57   1
             32     09      0             00F D4   0    01F  38  1




                                      Page 1 of 6
Part 1

  1. The diagram below shows the format of a virtual address. Please indicate
     the following fields by labeling the diagram: (If a field does not exist, do not
     draw it on the diagram.)

         VPO       The virtual page offset
         VPN       The virtual page number
         TLBI      The TLB index
         TLBT      The TLB tag


         19   18    17   16   15   14    13   12   11   10   9   8   7   6   5    4   3   2   1   0




  2. The diagram below shows the format of a physical address. Please indicate
     the following fields by labeling the diagram: (If a field does not exist, do not
     draw it on the diagram.)

         PPO       The physical page offset
         PPN       The physical page number


                    17   16   15   14    13   12   11   10   9   8   7   6   5    4   3   2   1   0




                                        Page 2 of 6
Part 2

For the given virtual addresses, please indicate the TLB entry accessed and the
physical address. Indicate whether the TLB misses and whether a page fault occurs.
If there is a page fault, enter “-” for “PPN” and leave the physical address blank.

Virtual address: 078E6

   1. Virtual address (one bit per box)
         19   18   17   16      15   14    13   12   11   10   9   8   7      6        5   4   3   2   1   0




   2. Address translation

         Parameter      Value                             Parameter               Value
         VPN            0x                                TLB Hit? (Y/N)
         TLB Index      0x                                Page Fault? (Y/N)
         TLB Tag        0x                                PPN                     0x

   3. Physical address(one bit per box)

                   17   16      15   14    13   12   11   10   9   8   7      6        5   4   3   2   1   0




Virtual address: 04AA4

   1. Virtual address (one bit per box)

         19   18   17   16      15   14    13   12   11   10   9   8   7      6        5   4   3   2   1   0




   2. Address translation




                                          Page 3 of 6
Parameter      Value                             Parameter               Value
    VPN            0x                                TLB Hit? (Y/N)
    TLB Index      0x                                Page Fault? (Y/N)
    TLB Tag        0x                                PPN                     0x

3. Physical address(one bit per box)

              17   16      15   14    13   12   11   10   9   8   7      6        5   4   3   2   1   0




                                     Page 4 of 6
Problem 2:
Consider the Pentium memory system (Figure 1). PTEs and PDEs are 32 bits wide.

  1. How many entries can the level-1 page table hold?


  2. Assume there is a single task running on the system. The task’s heap area is
     allocated in the physical range 0x660000 - 0x666600. The task’s stack
     area is allocated in the physical range 0x7999400 - 0x8000000. The
     task’s text area is allocated in the physical range 0x1000 - 0x1400.
     The task has no other sections.

       (a) How many valid PTEs are there?

       (b) How many valid PDEs are there?

       (c) How much memory is in use strictly by the Page Directory and Page
           Tables?


  3. If the Pentium used a flat page table, how much space would that page table
     take up?


  4. The Pentium can overlap some of the translation of a virtual address with
     the cache lookup for that address. If Intel wants to preserve this behavior but
     also double the size of the cache, how must they change the cache?




                                   Page 5 of 6
32
                CPU                                                                                 L2 and
                                                                         Result
                     Virtual address (VA)                                                         Main memory
      20                   12
  VPN                  VPO                                                      L1                        L1
                                                                                hit                       miss
           16          4
      TLBT TLBI


                                                          TLB                   L1 (128 sets, 4 lines/set)
 TLB                                                      hit
 miss
                                           ...




                                                                                      ...
 10             10                 TLB (16 sets, 4
VPN1 VPN2                          entries/set)
                                                         20         12                       20       7   5
                                                         PPN       PPO                      CT        CI CO
                                                                            Physical
                     PDE             PTE                                    address
                                                                              (PA)

 PDBR                  Page tables


                                Figure 1: Summary of Pentium address translation).




                                                     Page 6 of 6

More Related Content

Viewers also liked

Bath + Kitchen Today Magazine Features LUXE Linear Drains
Bath + Kitchen Today Magazine Features LUXE Linear DrainsBath + Kitchen Today Magazine Features LUXE Linear Drains
Bath + Kitchen Today Magazine Features LUXE Linear DrainsEric Carson
 
e-Commerce meets Fashion in the "Ticino Fashion Valley" - What's hot in the f...
e-Commerce meets Fashion in the "Ticino Fashion Valley" - What's hot in the f...e-Commerce meets Fashion in the "Ticino Fashion Valley" - What's hot in the f...
e-Commerce meets Fashion in the "Ticino Fashion Valley" - What's hot in the f...Contactlab
 
Сравнительная эффективность тромбовазима при внутрипредсердном тромбозе и спо...
Сравнительная эффективность тромбовазима при внутрипредсердном тромбозе и спо...Сравнительная эффективность тромбовазима при внутрипредсердном тромбозе и спо...
Сравнительная эффективность тромбовазима при внутрипредсердном тромбозе и спо...OBL-Pharm
 
Peugeot brand building
Peugeot brand buildingPeugeot brand building
Peugeot brand buildingNaresh2636
 

Viewers also liked (6)

Bath + Kitchen Today Magazine Features LUXE Linear Drains
Bath + Kitchen Today Magazine Features LUXE Linear DrainsBath + Kitchen Today Magazine Features LUXE Linear Drains
Bath + Kitchen Today Magazine Features LUXE Linear Drains
 
e-Commerce meets Fashion in the "Ticino Fashion Valley" - What's hot in the f...
e-Commerce meets Fashion in the "Ticino Fashion Valley" - What's hot in the f...e-Commerce meets Fashion in the "Ticino Fashion Valley" - What's hot in the f...
e-Commerce meets Fashion in the "Ticino Fashion Valley" - What's hot in the f...
 
Сравнительная эффективность тромбовазима при внутрипредсердном тромбозе и спо...
Сравнительная эффективность тромбовазима при внутрипредсердном тромбозе и спо...Сравнительная эффективность тромбовазима при внутрипредсердном тромбозе и спо...
Сравнительная эффективность тромбовазима при внутрипредсердном тромбозе и спо...
 
Manual de Partes de T. Oruga FIAT ALLIS FD14E
Manual de Partes de T. Oruga FIAT ALLIS FD14EManual de Partes de T. Oruga FIAT ALLIS FD14E
Manual de Partes de T. Oruga FIAT ALLIS FD14E
 
Engine systems diesel engine analyst - parte 4
Engine systems   diesel engine analyst - parte 4Engine systems   diesel engine analyst - parte 4
Engine systems diesel engine analyst - parte 4
 
Peugeot brand building
Peugeot brand buildingPeugeot brand building
Peugeot brand building
 

Similar to Vm examples

Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...Hsien-Hsin Sean Lee, Ph.D.
 
bfloat16 floating-point format | notes
bfloat16 floating-point format | notesbfloat16 floating-point format | notes
bfloat16 floating-point format | notesSubhajit Sahu
 
Lect2 up340 (100501)
Lect2 up340 (100501)Lect2 up340 (100501)
Lect2 up340 (100501)aicdesign
 
00 chapter07 and_08_conversion_subroutines_force_sp13
00 chapter07 and_08_conversion_subroutines_force_sp1300 chapter07 and_08_conversion_subroutines_force_sp13
00 chapter07 and_08_conversion_subroutines_force_sp13John Todora
 
Lmb162 abc manual-rev0.2
Lmb162 abc manual-rev0.2Lmb162 abc manual-rev0.2
Lmb162 abc manual-rev0.2aibad ahmed
 
MaskedVByte: SIMD-accelerated VByte
MaskedVByte: SIMD-accelerated VByteMaskedVByte: SIMD-accelerated VByte
MaskedVByte: SIMD-accelerated VByteDaniel Lemire
 
8051 smd kit_manual
8051 smd kit_manual8051 smd kit_manual
8051 smd kit_manualanishgoel
 
Graphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks AgeGraphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks AgeLorenzo Alberton
 
Ee2 chapter1 number_system
Ee2 chapter1 number_systemEe2 chapter1 number_system
Ee2 chapter1 number_systemCK Yang
 
Embedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerEmbedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerAmandeep Alag
 
[KOR] ODI no.004 analysis of oracle performance degradation caused by ineffic...
[KOR] ODI no.004 analysis of oracle performance degradation caused by ineffic...[KOR] ODI no.004 analysis of oracle performance degradation caused by ineffic...
[KOR] ODI no.004 analysis of oracle performance degradation caused by ineffic...EXEM
 
6.4.2.4 calculating and configuring an i pv6 route summarization instructions
6.4.2.4 calculating and configuring an i pv6 route summarization instructions6.4.2.4 calculating and configuring an i pv6 route summarization instructions
6.4.2.4 calculating and configuring an i pv6 route summarization instructionsBelen Sin Acento
 
Porting NetBSD to the open source LatticeMico32 CPU
Porting NetBSD to the open source LatticeMico32 CPUPorting NetBSD to the open source LatticeMico32 CPU
Porting NetBSD to the open source LatticeMico32 CPUYann Sionneau
 

Similar to Vm examples (20)

Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
Lec5 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Branch Pred...
 
S09mid2sol
S09mid2solS09mid2sol
S09mid2sol
 
bfloat16 floating-point format | notes
bfloat16 floating-point format | notesbfloat16 floating-point format | notes
bfloat16 floating-point format | notes
 
Hd44780a00 dtasheet
Hd44780a00 dtasheetHd44780a00 dtasheet
Hd44780a00 dtasheet
 
14941634.ppt
14941634.ppt14941634.ppt
14941634.ppt
 
Lect2 up340 (100501)
Lect2 up340 (100501)Lect2 up340 (100501)
Lect2 up340 (100501)
 
00 chapter07 and_08_conversion_subroutines_force_sp13
00 chapter07 and_08_conversion_subroutines_force_sp1300 chapter07 and_08_conversion_subroutines_force_sp13
00 chapter07 and_08_conversion_subroutines_force_sp13
 
Lmb162 abc manual-rev0.2
Lmb162 abc manual-rev0.2Lmb162 abc manual-rev0.2
Lmb162 abc manual-rev0.2
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
SPI Interface
SPI InterfaceSPI Interface
SPI Interface
 
MaskedVByte: SIMD-accelerated VByte
MaskedVByte: SIMD-accelerated VByteMaskedVByte: SIMD-accelerated VByte
MaskedVByte: SIMD-accelerated VByte
 
8051 smd kit_manual
8051 smd kit_manual8051 smd kit_manual
8051 smd kit_manual
 
Graphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks AgeGraphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks Age
 
Ee2 chapter1 number_system
Ee2 chapter1 number_systemEe2 chapter1 number_system
Ee2 chapter1 number_system
 
Embedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerEmbedded systems, 8051 microcontroller
Embedded systems, 8051 microcontroller
 
8051
80518051
8051
 
[KOR] ODI no.004 analysis of oracle performance degradation caused by ineffic...
[KOR] ODI no.004 analysis of oracle performance degradation caused by ineffic...[KOR] ODI no.004 analysis of oracle performance degradation caused by ineffic...
[KOR] ODI no.004 analysis of oracle performance degradation caused by ineffic...
 
6.4.2.4 calculating and configuring an i pv6 route summarization instructions
6.4.2.4 calculating and configuring an i pv6 route summarization instructions6.4.2.4 calculating and configuring an i pv6 route summarization instructions
6.4.2.4 calculating and configuring an i pv6 route summarization instructions
 
Porting NetBSD to the open source LatticeMico32 CPU
Porting NetBSD to the open source LatticeMico32 CPUPorting NetBSD to the open source LatticeMico32 CPU
Porting NetBSD to the open source LatticeMico32 CPU
 
8 x8m guide
8 x8m guide8 x8m guide
8 x8m guide
 

Vm examples

  • 1. Virtual Memory Examples Problem 1: This problem concerns the way virtual addresses are translated into physical ad- dresses. Imagine a system has the following parameters:   Virtual addresses are 20 bits wide.   Physical addresses are 18 bits wide.   The page size is 1024 bytes.   The TLB is 2-way set associative with 16 total entries. The contents of the TLB and the first 32 entries of the page table are shown as follows. All numbers are given in hexadecimal. TLB Page Table Index Tag PPN Valid VPN PPN Valid VPN PPN Valid 0 03 C3 1 000 71 1 010 60 0 01 71 0 001 28 1 011 57 0 1 00 28 1 002 93 1 012 68 1 01 35 1 003 AB 0 013 30 1 2 02 68 1 004 D6 0 014 0D 0 3A F1 0 005 53 1 015 2B 0 3 03 12 1 006 1F 1 016 9F 0 02 30 1 007 80 1 017 62 0 4 7F 05 0 008 02 0 018 C3 1 01 A1 0 009 35 1 019 04 0 5 00 53 1 00A 41 0 01A F1 1 03 4E 1 00B 86 1 01B 12 1 6 1B 34 0 00C A1 1 01C 30 0 00 1F 1 00D D5 1 01D 4E 1 7 03 38 1 00E 8E 0 01E 57 1 32 09 0 00F D4 0 01F 38 1 Page 1 of 6
  • 2. Part 1 1. The diagram below shows the format of a virtual address. Please indicate the following fields by labeling the diagram: (If a field does not exist, do not draw it on the diagram.) VPO The virtual page offset VPN The virtual page number TLBI The TLB index TLBT The TLB tag 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 2. The diagram below shows the format of a physical address. Please indicate the following fields by labeling the diagram: (If a field does not exist, do not draw it on the diagram.) PPO The physical page offset PPN The physical page number 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Page 2 of 6
  • 3. Part 2 For the given virtual addresses, please indicate the TLB entry accessed and the physical address. Indicate whether the TLB misses and whether a page fault occurs. If there is a page fault, enter “-” for “PPN” and leave the physical address blank. Virtual address: 078E6 1. Virtual address (one bit per box) 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 2. Address translation Parameter Value Parameter Value VPN 0x TLB Hit? (Y/N) TLB Index 0x Page Fault? (Y/N) TLB Tag 0x PPN 0x 3. Physical address(one bit per box) 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Virtual address: 04AA4 1. Virtual address (one bit per box) 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 2. Address translation Page 3 of 6
  • 4. Parameter Value Parameter Value VPN 0x TLB Hit? (Y/N) TLB Index 0x Page Fault? (Y/N) TLB Tag 0x PPN 0x 3. Physical address(one bit per box) 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Page 4 of 6
  • 5. Problem 2: Consider the Pentium memory system (Figure 1). PTEs and PDEs are 32 bits wide. 1. How many entries can the level-1 page table hold? 2. Assume there is a single task running on the system. The task’s heap area is allocated in the physical range 0x660000 - 0x666600. The task’s stack area is allocated in the physical range 0x7999400 - 0x8000000. The task’s text area is allocated in the physical range 0x1000 - 0x1400. The task has no other sections. (a) How many valid PTEs are there? (b) How many valid PDEs are there? (c) How much memory is in use strictly by the Page Directory and Page Tables? 3. If the Pentium used a flat page table, how much space would that page table take up? 4. The Pentium can overlap some of the translation of a virtual address with the cache lookup for that address. If Intel wants to preserve this behavior but also double the size of the cache, how must they change the cache? Page 5 of 6
  • 6. 32 CPU L2 and Result Virtual address (VA) Main memory 20 12 VPN VPO L1 L1 hit miss 16 4 TLBT TLBI TLB L1 (128 sets, 4 lines/set) TLB hit miss ... ... 10 10 TLB (16 sets, 4 VPN1 VPN2 entries/set) 20 12 20 7 5 PPN PPO CT CI CO Physical PDE PTE address (PA) PDBR Page tables Figure 1: Summary of Pentium address translation). Page 6 of 6