0:00
/
Preview

Demand Paging in Action: mmap, Page Faults, and RSS

Learn how to inspect a process’s virtual memory, use mmap to allocate pages, and observe page faults and physical memory allocation as they happen

In the previous video in our virtual memory series, we discussed demand paging. But that was mostly theoretical, explaining how demand paging works inside the Linux kernel and the mechanisms through which it handles page faults. In this follow-up video, we make it more concrete by learning to inspect the virtual memory of a running process to see demand paging in action.

If you watch this video, you will learn a few cool things:

  • What is demand paging (the compressed version; watch the previous video for a more in-depth explanation)

  • What is the /proc file system in the Linux kernel

  • How to read /proc/<pid>/maps to inspect the VMAs of a live process

  • How to read /proc/<pid>/smaps to inspect which VMA is consuming how much physical memory

  • How to use mmap

  • How to use getrusage to track the number of page faults of a process

If you are new to this series, it is based on my ebook called “Virtual Memory from First Principles”. It is available to read for free online and also available to purchase from Gumroad (PDF/Epub) and Amazon (Kindle edition).

Buy PDF/Epub

Get Kindle Edition


And, if you want to watch the previous videos in this series, the following is what has been published so far:

Share

User's avatar

Continue reading this post for free, courtesy of Abhinav Upadhyay.