Virtual Memory Mapping and Page Table

This section describes virtual memory page, physical memory frame, and page table that maps a page to a frame.

What Is Page? - Page is the block unit of the virtual memory. Each page is mapped to a frame in the physical memory. The page size is 4096 bytes on most Linux systems.

For a 32-bit CPU, the virtual memory address is 32 bits long, and divided into 2 sections: page index and page offset. If the page size is 4096 bytes, the first 20 bits of an address represent the page index and the last 12 bits represent the page offset. For example:

Virtual memory address: 0x000A502F
  = 0000 0000 0000 1010 0101 | 0000 0010 1111
                  page index |    page offset

What Is Frame? - Frame is the block unit of the physical memory. Since each page in the virtual memory is mapped to a frame, the frame size must match the page size.

What Is Page Table? - Page Table is a lookup table to map a page index in the virtual memory to the location of a frame in the physical memory. The page table is managed by the MMU (Memory Management Unit) as shown in the diagram below:

Page to Frame Map - Page Table
Page to Frame Map - Page Table

"getconf PAGESIZE" - Display Page Size - "getconf PAGESIZE" command returns the page size of the virtual memory.

herong$ getconf PAGESIZE

4096

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

Memory Management

 Layers of Memory and Access Speed

 List CPU Caches and Their Sizes

 Virtual Memory vs. Physical Memory

 Buffer Memory and Cache Memory

 Verify Cache Memory with "cp" Command

 What Is Swap Space

Virtual Memory Mapping and Page Table

 "ps -o rss,drs,trs,vsz,sz" - Process Status Options

 smem - Process Memory Usage Report

 pmap - Process Memory Map

 /proc/{id}/maps - Process Memory Map

 /proc/{id}/smaps - Process Memory Map Details

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Software Package Manager on CentOS - DNF and YUM

 vsftpd - Very Secure FTP Daemon

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB