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
- 01
Design the job queue file format
~1hDefine a simple line-based format for job commands and their IDs, read from a queue file.
- 02
Build a FIFO-based semaphore for concurrency limiting
~3hUse mkfifo and read/write tokens to implement an N-worker semaphore controlling how many jobs run at once.
- 03
Dispatch jobs as background processes
~2.5hLoop over the queue, acquiring a semaphore slot before backgrounding each job with proper output redirection.
- 04
Collect exit codes and per-job logs
~2hCapture each job's exit status into a results file and store its stdout/stderr in per-job log files.
- 05
Add progress reporting and summary
~1.5hPrint live progress (completed/total) and a final summary table of successes and failures.
- 06
Add flock-based locking for shared state
~1.5hUse flock to protect the shared results file from concurrent writes across workers.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack