Skip to content

A C program designed to generate and demonstrate pagefaults. A hands-on educational tool for understanding virtual memory management, page swapping, and kernel behavior in Operating Systems.

Notifications You must be signed in to change notification settings

loguinha/Code_Generate_Pagefault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

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

About

A C program designed to generate and demonstrate pagefaults. A hands-on educational tool for understanding virtual memory management, page swapping, and kernel behavior in Operating Systems.

Topics

Resources

Stars

Watchers

Forks

Languages