Skip to content

Implementing thread synchronization in a customized OS (qemu + xv6-public), as a part of Operating Systems [CSL3030] course project

Notifications You must be signed in to change notification settings

Sahil-1918912/OS-1060

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OS-1060 — Thread Synchronization in xv6-public

Built for QEMU Language License: MIT

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.


Overview

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.


Features

Custom waitpid() System Call

  • Allows a parent process to wait for a specific child process to terminate.
  • Enhances process control and management.

User-Space Barrier Synchronization

  • Implements barrier synchronization to coordinate multiple threads.
  • Ensures threads wait for each other at specific points in execution.

Thread Management

  • Functions to create, join, and terminate threads.
  • Enables concurrent execution within a single process.

Thread Synchronization

  • Implements locks and condition variables for thread synchronization.
  • Prevents race conditions and ensures data consistency.

Getting Started

Prerequisites

QEMU installed on your system.

Building and Running

Environment setup

  1. Install dependencies
sudo apt-get update
sudo apt-get install -y build-essential git python3 ninja-build
  1. Clone and build QEMU
git clone https://gitlab.com/qemu-project/qemu.git
cd qemu
./configure
make -j"$(nproc)"
sudo make install

If 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"

Building xv6-public

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

Running xv6 in QEMU

  • With GUI:
make qemu
  • Without GUI (terminal-only):
make qemu-nox

Running Test Programs

Run 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

Author

Sahil Narkhede
B.Tech, Computer Science & Engineering
Indian Institute of Technology, Jodhpur


References


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 — from waitpid() to full thread synchronization.*

About

Implementing thread synchronization in a customized OS (qemu + xv6-public), as a part of Operating Systems [CSL3030] course project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published