No description
Find a file
2025-11-05 21:16:27 +02:00
files init 2025-11-05 20:21:15 +02:00
src init 2025-11-05 20:21:15 +02:00
.gitignore init 2025-11-05 20:21:15 +02:00
dune-project init 2025-11-05 20:21:15 +02:00
README.md Removed part from the report 2025-11-05 21:16:27 +02:00
screenshot.png added screenshot 2025-11-05 20:32:15 +02:00
task3_en.pdf init 2025-11-05 20:21:15 +02:00
three.opam init 2025-11-05 20:21:15 +02:00

Multi-Domain Prime Finder with TUI

Pparallel prime number finder built with OCaml.

TUI Screenshot

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 bash or docker run -v .:/project -it docker.io/ocaml/opam:debian-13-ocaml-5.3 bash And then cd /project and opam 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 domain
  • q or Esc: Quit the program