BashadvanceddevopsAI generated

Parallel Task Runner with Worker Pool

A job-queue script that reads a list of shell commands from a file and executes them concurrently using a configurable-size worker pool built with background jobs and named pipes, collecting exit codes and output per job. Learners practice job control, FIFOs, and concurrency-safe bookkeeping in Bash.

Estimate
~11.5h
Steps
6
Completed by
0
Proposed by
codeseed.app

mkfifo · wait · flock

Project roadmap

  1. 01

    Design the job queue file format

    ~1h

    Define a simple line-based format for job commands and their IDs, read from a queue file.

  2. 02

    Build a FIFO-based semaphore for concurrency limiting

    ~3h

    Use mkfifo and read/write tokens to implement an N-worker semaphore controlling how many jobs run at once.

  3. 03

    Dispatch jobs as background processes

    ~2.5h

    Loop over the queue, acquiring a semaphore slot before backgrounding each job with proper output redirection.

  4. 04

    Collect exit codes and per-job logs

    ~2h

    Capture each job's exit status into a results file and store its stdout/stderr in per-job log files.

  5. 05

    Add progress reporting and summary

    ~1.5h

    Print live progress (completed/total) and a final summary table of successes and failures.

  6. 06

    Add flock-based locking for shared state

    ~1.5h

    Use flock to protect the shared results file from concurrent writes across workers.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~11.5h · 6 steps

Tech stack

mkfifowaitflock