This repository is part of my exploration into how Database Management Systems (DBMS) are built internally.
It contains an implementation of a Buffer Manager, which is a fundamental module in any DBMS.
This work is later integrated into my database system project: LittleDB.
The Buffer Manager handles in-memory pages that represent data read from disk.
Because disk operations are far slower than memory access, a buffer pool combined with page replacement policies ensures efficient performance.
This project includes:
- Buffer Pool – A memory region of fixed size used to store data pages.
- Page Abstraction – An in-memory representation of a database page.
- Frame System – Pages are stored in frames within the buffer pool.
- Replacement Policies:
- Least Recently Used (LRU)
- Clock Cache Algorithm
- Buffer Manager API – Functions to request, pin, unpin, and write back pages.
├── CMakeLists.txt
├── data
│ └── prueba_titanic.txt # Example file
├── include # Header files
│ ├── BufferManager.h
│ ├── BufferPool.h
│ ├── Clock.h
│ ├── Frame.h
│ ├── LRU.h
│ └── Page.h
├── main.cpp # Usage example
├── makefile
└── src # Source code
├── Buffer_Pool.cpp
├── BufferManager.cpp
├── Clock.cpp
├── Frame.cpp
├── LRU.cpp
└── Page.cpp
- ✅ Load and replace pages between disk and memory
- ✅ Pin/unpin pages to control eviction
- ✅ Support for two replacement strategies (LRU, Clock)
- ✅ Frame-based memory organization
- ✅ Designed for integration with LittleDB
You can compile the project either with CMake or with the included makefile.
mkdir build && cd build
cmake ..
make
./mainmake
./mainA sample dataset (data/prueba_titanic.txt) is provided.
The file main.cpp demonstrates creating a buffer manager, loading pages, and applying replacement algorithms.
This project was built from the ground up with the purpose of understanding:
- Internal design of DBMS buffer managers
- Memory management at the system level
- Implementation of LRU and Clock page replacement
- Building modular and extensible software components
This Buffer Manager is one of the foundational modules of my database system:
👉 LittleDB