← Back to Projects

ThreadLib Disk Scheduler

C++ user-level threading library paired with a concurrent disk scheduler that coordinates requester threads and SSTF service.

Overview

ThreadLib Disk Scheduler combines operating systems fundamentals with a working scheduling simulation. It implements a user-level thread library with context switching, locks, condition variables, yield behavior, and preemption support, then uses that library to coordinate a multi-requester disk scheduler.

Demo

No live demo available for this project. See the repo for setup and run instructions.

Description

C++ systems project that builds a user-level thread library and applies it to a disk request scheduler. The thread library exposes thread_libinit, thread_create, thread_yield, locks, condition variables, signal, and broadcast. It uses ucontext to allocate per-thread stacks and switch execution without kernel threads. Interrupt enable/disable calls guard scheduler-critical sections, and the public interface includes start_preemptions for asynchronous or deterministic preemption testing.

Thread library Threads are represented with a context, stack pointer, finished flag, and id. A FIFO ready queue drives scheduling. thread_create builds a new context with its own stack and routes it through a core wrapper; thread_yield returns the current thread to the ready queue and switches through the scheduler context. Locks track an owner plus a FIFO wait queue, while condition variables keep per-condition wait queues and re-acquire the associated lock after wakeup.

Disk scheduler The disk simulator creates one requester thread per input file plus a service thread. Requesters submit tracks into a bounded shared disk queue and wait for confirmation before sending the next request. The service thread waits until enough requests are available, picks the next request with Shortest Seek Time First from the current head position, prints the service event, updates the last served track, and signals the requester and queue-capacity conditions.

Testing The repository includes many focused thread tests for initialization, yielding, locking, waiting, signaling, broadcast behavior, and preemption cases, along with disk input files and output logs for scheduler validation.

Tech & tools

  • C++
  • ucontext
  • User-level threads
  • Synchronization
  • SSTF scheduling

Highlights

  • User-level threading with ucontext and per-thread stacks
  • Locks, condition variables, signal, broadcast, and yield semantics
  • Concurrent bounded-buffer disk scheduler using SSTF selection
  • Test suite covering thread lifecycle and synchronization behavior

More projects

tinyTemp

Custom tiny temperature monitor that evolved from an ATmega328P prototype into a compact ATtiny85 OLED PCB.

Award winning

WorldWide Rover

Award-winning internet-controlled rover that lets users drive and monitor a physical robot from anywhere in real time.

BareTag Tool Tracker

Smart tool tracking that helps teams instantly find equipment, prevent loss, and stay coordinated in real time.

Buffet

Automated trading system that tests strategies, learns from market behavior, and executes decisions with built-in risk controls.

HeadHunter

AI-powered job search assistant that helps people find better-fit roles faster, with smarter resume matching and cleaner tracking.

Meal Planner

Personal meal planning app that turns “what should I cook?” into a clear weekly routine with pantry awareness and shopping support.

BrickVision

Turns ideas or 3D models into buildable LEGO-style instructions, making custom creations faster and more accessible.

Pong on Assembly

Classic Pong rebuilt from the ground up in hardware and low-level assembly, showing full-stack systems engineering in action.

Custom Single-Cycle 32-Bit Processor

From-scratch 32-bit processor design that brings core computer architecture concepts to life in working hardware.

Multilateration 3D Positioning

3D location engine that estimates where an object is in space and validates accuracy through realistic simulation.

RISC-V Encryption

Encryption concepts implemented at the hardware-software boundary, showing security logic at instruction level detail.

PUF Tester

Hardware security testing toolkit for measuring unique device fingerprints and reliability under real test conditions.

tinyTemp

Custom tiny temperature monitor that evolved from an ATmega328P prototype into a compact ATtiny85 OLED PCB.

Award winning

WorldWide Rover

Award-winning internet-controlled rover that lets users drive and monitor a physical robot from anywhere in real time.