What is the size of the entry in the page table?

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 the page table can consist of up to 1 million records (2 ^ 32/2 ^ 12). Provided that each entry consists of 4 bytes , each process may require up to 4 MB of physical address space for the page table only.

What is the meaning of each entry consists of 4 bytes and why for each process it may take up to 4 MB of physical address space for the page table ?

+11
operating-system paging
source share
7 answers

The 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 the system.

Physical memory is the actual bits located at addresses in memory (DRAM), while virtual memory is where the OS "lies" to processes, telling them where it is in order to do things like enable 2 ^ 64 bits of address space, although more than 2 ^ 34 bits are usually used (2 ^ 32 bits are 4 gigabytes, so 2 ^ 34 is 16 GB.) Most page table sizes are 4096 KB by default for each process, but the number of entries in the page table may increase if the process requires more space for processes. Page table sizes can also be initially allocated with smaller or larger volumes or memory, just 4 KB, as a rule, is the best size for most processes.

Note that the page table is a page record table. Both may have different sizes, but the size of the page table is usually 4096 KB or 4 MB, and the size of the page table is increased by adding more records.

+7
source share

1) Since 4 bytes (32 bits) is exactly what you need to store any address in a 32-bit address space.

2) Since 1 million records of 4 bytes is 4 MB.

+4
source share

As for why the PTE (page table entry) is 4 bytes:

Several answers say this because the address space is 32 bits, and PTE requires 32 bits to store the address.

But the PTE does not contain the full byte address, only the physical page number. The remaining bits contain flags or remain unused. It does not have to be 4 bytes for sure.

+4
source share
  • Your first doubt is on the line: "Each entry in the page table entry, also called PTE, consists of 4 bytes." To understand this, first discuss what the page table contains? "," Answer "will be PTE. Thus, this is 4 bytes - this is the size of each PTE, which consists of a virtual address, offset (and, possibly, 1-2 other fields, if necessary / optional)

  • So, now you know what the page table contains, you can easily calculate the memory space that is required, that is: Total no. from PTE times PTE size. Which will be: 1m * 4 bytes = 4MB Hope this clears your doubts. :)

+3
source share

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

On a 32-bit system with a 4 KB memory page size (2 ^ 2 * 2 ^ 10 V), the maximum number of pages a process can have is 2 ^ (32-12) = 1M. Each process considers that it has access to all physical memory. To translate all 1M virtual memory addresses to physical memory addresses, the process may need to store 1 M PTE, i.e. 4 MB.

+1
source share

The page table element is the bit number needed to get the frame number. for example, if you have a physical memory with 2 ^ 32 frames, then you 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 is 1 million, that is, the total size of the page table = entry in the page table * number of pages = 4b * 1million = 4mb.

therefore, 4mb is required to store the storage table in main memory (physical memory).

+1
source share

Honestly, I'm a little new to this, but in short, it seems that 4 MB is due to the fact that there are 1 million records (each PTE stores a physical page number, if one exists); therefore, 1 million PTEs, which is 2 ^ 20 = 1 MB. 1MB * 4 bytes = 4MB, so each process will need this for its page tables.

0
source share

All Articles