37 lines
1015 B
Markdown
37 lines
1015 B
Markdown
# Fork vs Threads Experiments
|
|
|
|
This project compares Linux process creation (fork) versus thread creation (pthreads).
|
|
It includes timing, scaling, and stress tests to show performance differences and
|
|
system limits.
|
|
|
|
## How to run
|
|
|
|
Run all experiments (safe by default):
|
|
|
|
```sh
|
|
bash run_all_experiments.sh
|
|
```
|
|
|
|
Run individual experiments (examples):
|
|
|
|
```sh
|
|
bash creation_time_experiment/bash_test_iter.sh
|
|
bash thread_recursive_scaling/run_thread_recursive.sh
|
|
```
|
|
|
|
Enable the dangerous stress tests (timeboxed):
|
|
|
|
```sh
|
|
ALLOW_DANGEROUS=1 FORK_BOMB_SECONDS=5 MAX_LIMIT_SECONDS=5 bash run_all_experiments.sh
|
|
```
|
|
|
|
## Potential dangers
|
|
|
|
- The fork bomb and max-limit stress tests can freeze your machine or make it
|
|
unresponsive by exhausting processes/threads.
|
|
- You may need elevated limits (ulimit or sysctl) to run high-stress tests.
|
|
- Running heavy tests on shared systems or laptops can disrupt other users and
|
|
risk data loss if the system becomes unstable.
|
|
|
|
If you are unsure, do not enable the dangerous tests.
|