Thread: Virtual Memory System

  1. #1
    Registered User
    Join Date
    Jun 2016
    Posts
    7

    Question Virtual Memory System

    Hi I am studying for my operating system programming exam and we been provided with a sample exam but no answers have been given.I have answered a) and b) (not sure if they are right) but I am not sure how to answer c) and d). It will be much appreciated if you explain how to get the right answer. Thanks.

    Consider a virtual memory system with the following parameters:

    - 64-bit virtual address
    - 32-kbyte virtual page size
    - 64-bit Page Table Entry (PTE)
    - 2-Gbyte physical memory

    (a) Draw a diagram of the 32-bit address showing the length and placement of all bit 1elds i.e. the offset in the page(O), and the page number (P).

    = PPPP PPPP PPPP PPPP PPPP | OOOO OOOO OOOO

    (b) How many virtual pages are available in this system?

    = 2^20 pages (the number of bits for the page number)

    (c) How many physical frames are available in this system?

    (d) What is the size, in bytes, of the page table?
    Last edited by arrowjack; 06-02-2016 at 08:43 PM.

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    (a) How many bits would fit a value between 0 and 32-kiB?
    (b) How many bits are left after you subtract the offset ones? That is the 2^N you need.
    (c) Isn't this a simple division, disregarding memory-mapped IO and such?

    (d) Now, this question is misleading, because it implied that there's only a page table associated with paging, but in reality there are more tables available to ease on memory usage( which end up using more memory if you need them all... ). Anyways, assuming there exists only the main page table, it would need to have (2-GiB/32-KiB) entries, obviously right? Now, each entry needs to be at least 64-bits, so let's assume it's 64-bit, that's 8-B. Multiply the amount of the entries by the size of each entry and you max the maximum size of the page table
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Jun 2016
    Posts
    7
    Thanks, ok so is this right:
    a) PPPP PPPP PPPP PPPP P | OOOO OOOO OOOO OOO
    b) 2^17 entries
    c)2GB/32KB = 2^31/2^15 = 2^16
    d)8GB/32KB X 8B = 2MB ??? Not sure if this is correct

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    (a) You put an extra zero there, remove it and it should be fine.
    (d) Isn't physical memory 2-GiB, as you stated earlier? Your math is right, I just don't know if your numbers are the right ones.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. virtual memory system
    By invinceable in forum Tech Board
    Replies: 4
    Last Post: 06-14-2013, 10:11 AM
  2. Virtual File System Management
    By rsky613 in forum C Programming
    Replies: 3
    Last Post: 04-24-2011, 07:00 AM
  3. Replies: 2
    Last Post: 09-28-2006, 01:06 PM
  4. Replies: 4
    Last Post: 03-29-2004, 07:56 PM
  5. Virtual Memory system
    By sicstus in forum C Programming
    Replies: 1
    Last Post: 05-20-2002, 04:16 PM

Tags for this Thread