34 lines
952 B
Markdown
34 lines
952 B
Markdown
# 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/PSS and snapshot overhead)
|
|
- `stdout.log` / `stderr.log` — benchmark logs
|