Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between the Page Size and Page Table Entry size

I am not able to understand the difference between Page Size and Page Table Entry size.

From my understanding, Page size is used to divide the Page table in equal no. of blocks called Pages and the same size is used to divide the main memory into frames.

Page Size = Frame Size.

Sorry for poor drawing skills. This is my visualization of the Page Table

enter image description here

Where as Page Table Entry Size is the size occupied by the each page entry. So,

Page Table Entry Size = Page Size.

But Page Table entry size is calculated by the number of bits in the frame number.

Can anyone please explain how Page Size differs from Page Table Entry size? Why Page Table Entry size is calculated basing on No. of bits in the frame instead of the page?

Please help me visualize how exact the page table will be with all the above components

like image 311
Surya Teja Vemparala Avatar asked Sep 22 '16 03:09

Surya Teja Vemparala


People also ask

What is the size of a page table entry?

Page Directory and Page Table entries are each 4 bytes long, so the Page Directory and Page Tables are a maximum of 4 Kbytes, which also happens to be the Page Frame size. The high-order 20 bits point to the base of a Page Table or Page Frame. Bits 9 to 11 are available to the operating system for its own use.

What is page and page table?

Page Table is a data structure used by the virtual memory system to store the mapping between logical addresses and physical addresses. Logical addresses are generated by the CPU for the pages of the processes therefore they are generally used by the processes.

What is a page table entry?

Page table entry. Each page table entry (PTE) holds the mapping between a virtual address of a page and the address of a physical frame. There is also auxiliary information about the page such as a present bit, a dirty or modified bit, address space or process ID information, amongst others.

What is meant by page size?

With print documents, page size refers to the size of the paper for the final printed document. Examples include letter size (8.5 x 11-inches) or legal (8.5 x 14-inches).


2 Answers

Why Page Table Entry size is calculated basing on No. of bits in the frame instead of the page?

The PAGE FRAME size is always the same as the PAGE size.

Can anyone please explain how Page Size differs from Page Table Entry size?

The PAGE TABLE ENTRY Size is dependent upon the PAGE size but is not calculated rom it.

A PAGE TABLE is a data structure that defines the logical address space of a process. A process address space consists of a set of PAGES. The size of a page can be any multiple of 2. The smallest page size I have seen is 512 bytes and the largest can be megabytes (or possibly gigabytes).

A PAGE TABLE is composed of PAGE TABLE ENTRIES. A PAGE TABLE ENTRY describes a single page in the process's logical address space. A PAGE TABLE ENTRY identifies the physical page frame that the logical page maps to and the attributes of the page.

A PAGE TABLE ENTRY then requires some number of bits to describe the page and some number of bits to maps the page to a physical page frame.

PAGE TABLE ENTRIES are always powers of 2 in size and are typically 4, 8, or 16 bytes long. Thus PAGE sizes are orders of magnitude larger than PAGE TABLE ENTRIES sizes.

The number of bits used to map PAGE to PAGE FRAMES is

  maximum amount of physical memory / page size

Larger physical memory support => larger page table entries.

Larger PAGE size => smaller page table entries.

If a system wants to support 2^32 bytes of memory using 512 (2^9) byte PAGES, it needs 2^23 bits in a PAGE TABLE ENTRY to map logical pages to physical page frames. That would leave 9 bits for PAGE description in a 32-bit PAGE TABLE ENTRY.

like image 176
user3344003 Avatar answered Sep 19 '22 08:09

user3344003


"Page Size = Frame Size" This is correct. Physical memory divided into chunks called "page-frames". Virtual memory divided into chunks called "pages". PTE contains the base address of a page-frame and based on the offset we decide the actual address. Refer to Understanding the Linux kernel Ch. 2 memory addressing.

Explained here in Fig-3.1

like image 36
mahesh waldiya Avatar answered Sep 22 '22 08:09

mahesh waldiya