added chunked Pi calculations test for fork vs thread

This commit is contained in:
2026-05-26 17:18:48 +03:00
parent 34d7c37f8a
commit c9a4b7f85d
7 changed files with 894 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
# Pi Digits Benchmark
This benchmark compares pthread-based parallelism and fork()-based parallelism
for computing digits of pi in independent chunks.
## Configuration (environment variables)
- `THREAD_COUNT` : number of worker threads
- `PROCESS_COUNT` : number of worker processes
- `PI_DIGITS` : total digits of pi to compute
- `CHUNK_SIZE` : digits per worker
Defaults: `THREAD_COUNT=4`, `PROCESS_COUNT=4`, `PI_DIGITS=2000`, `CHUNK_SIZE=500`
## Run
```sh
# Run both modes sequentially
bash run_pi_digits_benchmark.sh
# Run a single mode
bash run_pi_digits_benchmark.sh thread
bash run_pi_digits_benchmark.sh process
```
## Outputs
Per-run outputs are stored under `runs/`:
- `pi_digits.txt` — final concatenated digits
- `workers.csv` — per-worker durations and chunk metadata
- `results.csv` — per-run summary metrics (includes aggregated RSS/VSZ and snapshot overhead)
- `stdout.log` / `stderr.log` — benchmark logs