Parallel Programming & Threading

Coursework spanning OpenMP shared-memory parallelism, MPI distributed computing, pthread concurrency, and CPU scheduling algorithms

Technology Stack
C++
C
OpenMP
MPI
POSIX Threads
SLURM
CMake
Systems Programming

Project Overview

This collection of coursework from my Parallel Programming and Operating Systems courses covers the full spectrum of concurrency — from shared-memory parallelism with OpenMP, to distributed memory computing with MPI on an HPC cluster, to thread-level synchronization with POSIX threads, and process scheduling simulation at the OS level. Each assignment tackles a different parallel paradigm and synchronization challenge, building hands-on systems programming experience from the ground up.

Coursework Highlights

OpenMP Medicaid Data Summarizer (A0.2)

Parallelized a Medicaid CSV summarizer that aggregates total payments by HCPCS code, comparing a sequential baseline against an OpenMP implementation with per-thread local hash maps.

  • • Reads the entire CSV into memory, then splits work across OpenMP threads by file chunk
  • • Aligns chunk boundaries to full line breaks so threads never parse partial rows
  • • Each thread accumulates totals in a local unordered_map, merged into a global result at the end
  • • Custom Stopwatch instrumentation measures read, summarize, copy, and sort phases separately

MPI Distributed Web Crawl Analysis (A2)

Distributed analysis of a large web crawl dataset across 16 MPI ranks on an HPC cluster, computing global statistics and top/bottom URL rankings.

  • • Round-robin file assignment distributes 25,440 crawl files across MPI ranks
  • • MPI_Reduce and MPI_Allreduce for global sums, counts, min/max, and distributed median
  • • Distributed median via binary search with MPI_Allreduce count aggregation per iteration
  • • MPI_Gather collects per-rank top/bottom candidates for global ranking merge on rank 0

pthread Parallel Image File Writes (a3.5_threading)

Parallelized image file writes by splitting data into blocks and dispatching each block to a POSIX thread, with mutex-protected shared file I/O.

  • • Splits image data into fixed-size blocks and spawns a pthread worker per block
  • • pthread_mutex_t guards fseek/fwrite calls in the shared write delegate
  • • Bounded thread pool pattern — joins threads when MAX_THREADS is reached before spawning more
  • • Each thread receives its own ThreadArgs struct with block offset, size, and block number

CPU Process Scheduling Simulators (a3_proc_scheduling)

Implemented four CPU scheduling algorithms that simulate how an OS manages concurrent processes on a single core, computing waiting time and turnaround time metrics.

  • • First-Come First-Served (FCFS) with non-preemptive sequential execution
  • • Shortest Job First (SJF) selecting the shortest available burst at each decision point
  • • Round Robin with configurable time quantum and queue rotation on completion
  • • Shortest Remaining Time First (SRTF) with implicit preemption each clock tick

Technical Approach

  • • Work partitioning strategies: file chunk splitting, round-robin file assignment, and block-level I/O
  • • Thread-safe aggregation via local data structures merged after parallel phases, or mutex-protected shared resources
  • • MPI collective operations (Reduce, Allreduce, Gather) for global statistics across distributed ranks
  • • Performance instrumentation with custom stopwatch timing to isolate bottlenecks
  • • HPC job submission via SLURM batch scripts (.sbatch) for cluster execution

Results & Insights

Performance at Scale

The MPI web crawl analysis processed over 658 million rows from 25,440 files in approximately 323 seconds across 16 MPI ranks on an HPC cluster. The sequential Medicaid CSV summarizer took roughly 438 seconds for the read-and-summarize phase alone, motivating the OpenMP parallelization with thread-local hash maps and line-boundary-safe chunking.

Concurrency Lessons

These assignments reinforced the tradeoffs between parallel paradigms: thread-local accumulation avoids lock contention but requires a merge step, mutex-protected I/O serializes writes but keeps file state consistent, and scheduling algorithm choice (SRTF vs Round Robin) directly impacts waiting time and responsiveness under different workload patterns.

658M+

Rows Processed (MPI)

16

MPI Ranks

4

Scheduling Algorithms

2

Parallel Paradigms (Shared + Distributed)