Paging

Introduction

Memory is divided into equal fixed-size chunks, called frames.

  • a power of 2 is used for the size, typically 4 or 8 KB.

The logical address space of a process is divided into fixed-size blocks, of the same size, called pages.

While dividing the address space into pages, the linker usually starts a new page when a new segment starts.

In a logical address:

  • the most significant bits represent the page number.

  • the least significant bits represent an offset within the page.

Memory management unit (MMU)

Logical address to physical address translation

Structuring the logical address space of the process in order to map the whole or at least a fraction, of the address space provided by the processor (in any case, always greater than or equal to the size of the existing main memory), it becomes possible to eliminate the need for the limit register associated with the size of the page table.

  • As a consequence, the gap between the heap memory and the stack can be maximized.

There is not limit register associated with the page.

Page table entries

Page table contains one entry per page.

Entry definition:

  • O/F – a flag indicating if the page has been already assigned to process.

  • M/S – a flag indicating if the page is in memory.

  • ref – a flag indicating if the page has been referenced.

  • mod – a flag indicating if the page has been modified.

  • perm – permissions.

  • frame number – frame where the page is, if in memory.

  • block number in swap area – the block where the page is, in the swapping area.

Analysis

Advantages

  • general – the scope of your application is independent of the type of processes that will be executed (number and size of their address spaces).

  • good usage of main memory – does not lead to external fragmentation and internal fragmentation is practically negligible.

  • does not have special hardware requirements – the memory management units in today’s general-purpose processors implement it.

Disadvantages

  • longer memory access – double access to memory, because of prior access to the page table.

    • The existence of a TLB (translation lookaside buffer) minimizes the impact.

  • very demanding operability – requires the existence of a set of support operations, that are complex and have to be carefully designed to not compromise efficiency.

Last updated