Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 1.12 KB

File metadata and controls

25 lines (17 loc) · 1.12 KB

PageFault Generator & Demonstrator

A C program designed to generate and demonstrate pagefaults intentionally. This project serves as an educational tool to help understand how operating systems manage virtual memory, handle page faults, and swap pages between RAM and disk.

About

This project was created to provide a practical insight into the memory management mechanisms of an operating system. By deliberately generating pagefaults, it allows students and developers to visualize and understand the concepts of virtual memory, demand paging, and kernel intervention.

How It Works

The program works by:

  1. Accessing a large array that exceeds the available physical memory (RAM).
  2. Forcing the OS to continuously swap pages in and out from the disk (swap area).
  3. Generating a high rate of pagefaults, which can be observed using tools like top, htop, or vmstat.

How to Compile and Run

Prerequisites

  • A GCC compiler (e.g., build-essential on Ubuntu)
  • A Linux-based operating system (for specific OS features)

Compilation

Compile the source code using GCC:

gcc -o pagefault_gen pagefault.c