Skip to content

Agam-Saraf/Advanced-Operating-Systems

Repository files navigation

Advanced Operating Systems — CS 6210

Georgia Tech · Spring 2026 · Grade: A

Five systems programming projects in C/C++, progressing from thread synchronization fundamentals through virtualization, parallel computing, and distributed systems to a full MapReduce framework.


Projects

P0 — Thread-Safe Producer-Consumer Queue

p0-producer-consumer/ · C · pthreads

Identified and fixed concurrency bugs in a multi-producer, multi-consumer queue:

  • Race condition on shared g_num_prod counter — added mutex protection
  • Undefined behavior from joining a detached thread — removed the detach
  • Segfault from dereferencing an integer cast to void* — fixed return value interpretation
  • Double-free on a non-heap value — removed erroneous free() call

Key concepts: mutex locking, condition signaling, thread lifecycle management, sched_yield() for cooperative scheduling.


P1 — Virtual Machine CPU & Memory Scheduling

p1-vm-scheduling/ · C · libvirt API

Two KVM hypervisor schedulers built using the libvirt API:

vCPU Scheduler — Monitors per-vCPU utilization across guest domains and dynamically pins vCPUs to pCPUs to balance load. Uses a greedy re-pinning algorithm that iterates over the most loaded pCPUs and migrates vCPUs to underutilized cores. Runs on a configurable interval with a utilization threshold to avoid unnecessary migrations.

Memory Coordinator — Monitors memory pressure across guest VMs using virDomainMemoryStats. Implements a balloon driver controller that inflates balloons on VMs with excess free memory and deflates on memory-starved VMs. Transfers memory between VMs in fixed increments while respecting minimum guarantees.


P2 — MPI & OpenMP Barrier Synchronization

p2-barriers/ · C · MPI · OpenMP

Four barrier implementations benchmarked for scalability:

Barrier Model Approach
Centralized Counter OpenMP Atomic counter with busy-wait spin
MCS Tree OpenMP Tournament-style tree barrier (O(log P) rounds)
Centralized Counter MPI MPI_Send/MPI_Recv fan-in + broadcast
Tournament MPI Pairwise exchange in log₂(P) rounds

Combined barrier uses MPI across nodes + OpenMP within each node for hybrid parallelism. Includes performance analysis report comparing barrier latency vs. thread/process count.


P3 — Distributed Store with Async gRPC

p3-distributed-store/ · C++ · gRPC · pthreads

A middleware store that sits between user clients and vendor backends:

  • Async gRPC ServerServerCompletionQueue with the CallData state-machine pattern (CREATE → PROCESS → FINISH). Incoming RPCs are dispatched to a custom thread pool for parallel processing.
  • Async gRPC Client — Per-request CompletionQueue fires vendor RPCs in parallel; collates all responses before replying to the client.
  • Custom Thread Pool — Configurable worker count, mutex-protected job queue, condition variable signaling, clean shutdown with join-all.
  • Round-Robin Load Balancing — Thread-safe per-vendor counter distributes requests evenly across backend replicas.

P4 — MapReduce Framework

p4-mapreduce/ · C++ · gRPC · Protobuf

A simplified MapReduce implementation based on the Dean & Ghemawat (2004) paper:

┌──────────┐     gRPC      ┌──────────┐
│  Master  │ ──────────────▶│ Worker 1 │──▶ Map / Reduce
│          │                └──────────┘
│  • Shard │     gRPC      ┌──────────┐
│  • Assign│ ──────────────▶│ Worker 2 │──▶ Map / Reduce
│  • Track │                └──────────┘
│  • Retry │     gRPC      ┌──────────┐
│          │ ──────────────▶│ Worker N │──▶ Map / Reduce
└──────────┘                └──────────┘

Key design decisions:

  • File Sharding — Newline-aligned shards that can span multiple input files
  • Parallel Dispatchstd::async launches map/reduce tasks concurrently across idle workers
  • Key Partitioningstd::hash<string> % R ensures all occurrences of a key reach the same reducer
  • Sorted Outputstd::map in the reduce phase provides automatic key ordering
  • Fault Tolerance — 60s gRPC deadline; timed-out or crashed workers are blacklisted and tasks reassigned

Tech Stack

C · C++ · gRPC · Protobuf · pthreads · MPI · OpenMP · libvirt · CMake

Author

Agam Saraf — Georgia Institute of Technology

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors