Implementation of thread synchronization mechanisms in a customized version of xv6-public, running inside QEMU, developed as part of the Operating Systems (CSL3030) course project.
This project extends the xv6-public operating system to include advanced process and thread management functionalities such as:
- Custom
waitpid()system call - User-space barrier synchronization
- Thread creation, joining, and termination
- Thread synchronization using locks and condition variables
All implementations were built and tested using QEMU, simulating an x86 machine.
- Allows a parent process to wait for a specific child process to terminate.
- Enhances process control and management.
- Implements barrier synchronization to coordinate multiple threads.
- Ensures threads wait for each other at specific points in execution.
- Functions to create, join, and terminate threads.
- Enables concurrent execution within a single process.
- Implements locks and condition variables for thread synchronization.
- Prevents race conditions and ensures data consistency.
QEMU installed on your system.
- Install dependencies
sudo apt-get update
sudo apt-get install -y build-essential git python3 ninja-build- Clone and build QEMU
git clone https://gitlab.com/qemu-project/qemu.git
cd qemu
./configure
make -j"$(nproc)"
sudo make installIf you see errors about Sphinx or missing documentation tools, install the recommended packages:
pip install "sphinx==6.2.1" "sphinx-rtd-theme==1.2.2"Navigate to the xv6 directory for this project (replace with the required release):
cd OS-1060/xv6-public-<version>Clean and build:
make clean
make- With GUI:
make qemu- Without GUI (terminal-only):
make qemu-noxRun tests from the xv6 shell prompt ($):
| Task | Executable(s) | Description |
|---|---|---|
| Task 1 | t_waitpid |
Tests the custom waitpid() syscall |
| Task 2 | t_barrier |
Tests user-space barrier synchronization |
| Task 3 | t_threads |
Tests multithreading (create, join, exit) |
| Task 4 | t_lock, t_l_cv1, t_l_cv2 |
Tests lock and condition variable synchronization |
Sahil Narkhede
B.Tech, Computer Science & Engineering
Indian Institute of Technology, Jodhpur
- MIT xv6-public (GitHub)
- QEMU Official Documentation
- Operating Systems (CSL3030), IIT Jodhpur
This project demonstrates process management, synchronization primitives, and thread-level concurrency inside a pedagogical OS kernel (xv6).
It was built incrementally across four versions, each adding a core OS concept — fromwaitpid()to full thread synchronization.*