Skip to content

avyask/memory-access-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memory Access Pattern Tracker

This project is part of coursework for CS 5565 - Advanced Linux Kernel Programming at Virginia Tech (Project Specification)

The goal of this assignment is to track memory access patterns of a userspace programs through a kernel module that tracks page access frequency.


Project Structure

File Description
memalloc.c A user-space program that allocates a 1GB memory region. It writes the virtual address of the allocated block to the kernel module’s /proc file. The program also simulates different memory access patterns:
- Reads all pages in [0, 256MB] sequentially and continuously as fast as possible.
- Reads all pages in [256MB, 512MB] every 1 ms to replicate a slower access region.
page-walker-kmod.c A Linux kernel module that spawns two kernel threads:
- scanner kthread: Periodically scans the access (A) bit of all 4KB pages in the 1GB buffer and aggregates access counts every 100 ms.
- logger kthread: Access frequency data is periodically logged to kernel log every 1s using printk, viewable via dmesg or /var/log/kern.log.
helper.c A collection of helper functions derived from MoatLab’s LeapIO project.

Build and Run Instructions

1. Compile and Insert the Kernel Module

make
sudo insmod page-walker-kmod.ko

2. Run the User-Space Program

gcc memalloc.c -o memalloc
sudo ./memalloc

3. View Kernel Logs

dmesg | tail -n 50

4. Remove the Module When Done

sudo rmmod page-walker-kmod

Key Concepts

  • Virtual-to-physical page mapping
  • Walking page table in the Linux kernel
  • Access bit (A-bit) scanning
  • Kernel threading and synchronization
  • User-kernel communication through /proc

About

To track memory access patterns of a userspace programs through a linux kernel module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published