What is page table entry size?

前端 未结 7 1170
灰色年华
灰色年华 2020-12-24 16:00

I found this example.

Consider a system with a 32-bit logical address space. If the page size in such a system is 4 KB (2^12), then a page table may

相关标签:
7条回答
  • 2020-12-24 16:07

    A page table is a table of conversions from virtual to physical addresses that the OS uses to artificially increase the total amount of main memory available in a system.

    Physical memory is the actual bits located at addresses in memory (DRAM), while virtual memory is where the OS "lies" to processes by telling them where it's at, in order to do things like allow for 2^64 bits of address space, despite the fact that 2^34 bits is the most RAM normally used. (2^32 bits is 4 gigabytes, so 2^34 is 16 gb.) Most default page table sizes are 4096 kb for each process, but the number of page table entries can increase if the process needs more process space. Page table sizes can also initially be allocated smaller or larger amounts or memory, it's just that 4 kb is usually the best size for most processes.

    Note that a page table is a table of page entries. Both can have different sizes, but page table sizes are most commonly 4096 kb or 4 mb and page table size is increased by adding more entries.

    0 讨论(0)
  • 2020-12-24 16:07

    1) Because 4 bytes (32 bits) is exactly the right amount of space to hold any address in a 32-bit address space.

    2) Because 1 million entries of 4 bytes each makes 4MB.

    0 讨论(0)
  • 2020-12-24 16:07
    1. Your first doubt is in the line, "Each entry in the Page Table Entry, also called PTE, consists of 4 bytes". To understand this, first let's discuss what does page table contain?", Answer will be PTEs. So,this 4 bytes is the size of each PTE which consist of virtual address, offset,( And maybe 1-2 other fields if are required/desired)

    2. So, now you know what page table contains, you can easily calculate the memory space it will take, that is: Total no. of PTEs times the size of a PTE. Which will be: 1m * 4 bytes= 4MB Hope this clears your doubt. :)

    0 讨论(0)
  • 2020-12-24 16:09

    So, the entry refers to page table entry (PTE). The data stored in each entry is the physical memory address (PFN). The underlying assumption here is the physical memory also uses a 32-bit address space. Therefore, PTE will be at least 4 bytes (4 * 8 = 32 bits).

    In a 32-bit system with memory page size of 4KB (2^2 * 2^10 B), the maximum number of pages a process could have will be 2^(32-12) = 1M. Each process thinks it has access to all physical memory. In order to translate all 1M virtual memory addresses to physical memory addresses, a process may need to store 1 M PTEs, that is 4MB.

    0 讨论(0)
  • 2020-12-24 16:15

    Honestly a bit new to this myself, but to keep things short it looks like 4MB comes from the fact that there are 1 million entries (each PTE stores a physical page number, assuming it exists); therefore, 1 million PTE's, which is 2^20 = 1MB. 1MB * 4 Bytes = 4MB, so each process will require that for their page tables.

    0 讨论(0)
  • 2020-12-24 16:18

    The page table entry is the number number of bits required to get any frame number . for example if you have a physical memory with 2^32 frames , then you would need 32 bits to represent it. These 32 bits are stored in the page table in 4 bytes(32/8) .

    Now, since the number of pages are 1 million i.e. so the total size of the page table = page table entry*number of pages =4b*1million =4mb.

    hence, 4mb would be required to store store the table in the main memory(physical memory).

    0 讨论(0)
提交回复
热议问题