| files | ||
| src | ||
| .gitignore | ||
| dune-project | ||
| README.md | ||
| screenshot.png | ||
| task3_en.pdf | ||
| three.opam | ||
Multi-Domain Prime Finder with TUI
Pparallel prime number finder built with OCaml.
Overview
This program processes multiple files in parallel, finding the minimum and maximum prime numbers in each file.
Prerequisites
- OCaml >=5.0+ (required for domain support)
- Dune 3.8+ (build system)
- Notty (TUI library)
If you can't install OCaml, you can use the opam docker image.
podman run -v .:/project:z -it docker.io/ocaml/opam:debian-13-ocaml-5.3 bashordocker run -v .:/project -it docker.io/ocaml/opam:debian-13-ocaml-5.3 bashAnd thencd /projectandopam install dune
Install dependencies:
opam install notty
Build
From the project root:
dune build
Usage
Run with default settings (4 workers, processes files directory):
dune exec ./src/main.exe
Custom Directory
Specify a different directory:
dune exec ./src/main.exe -- /path/to/directory
Custom Initial Worker Count
Specify directory and initial number of workers:
dune exec ./src/main.exe -- files 2
This starts with 2 worker domains processing files from the files directory.
Add Processing Delay
Add an artificial delay (in milliseconds) to slow down processing for demonstration:
dune exec ./src/main.exe -- files 4 55
This processes files from the files directory with 4 workers, adding a 55ms delay per line processed.
ALL
dune exec ./src/main.exe -- [DIRECTORY] [NUM_WORKERS] [DELAY_MS]
- DIRECTORY: Path to folder containing .txt files (default:
files) - NUM_WORKERS: Initial number of worker domains (default:
4) - DELAY_MS: Optional delay in milliseconds to add per line processed (default:
0)
While the program is running, you can use these keyboard controls:
+: Add a new worker domain-: Remove a worker domainqorEsc: Quit the program
