christoff-buerger/racr

thread-safe RACR-library installation

Closed this issue · 1 comments

The install.bash script for installing RCAR-libraries (cf. #44) still has to apply file locks (cf. #93) to become thread-safe.

Its current race-condition when several instances are run in parallel is that two instances compile the same Scheme files for the same Scheme system, essentially letting both compilations contest on the generated binary. Depending on how the binary is written, this can yield corrupted binaries (e.g., if the binary is generated byte-wise and not as a single atomic step). Other issues might arise if one script instance generates binaries anew that are used by others generated in parallel, yielding stale binaries or compilation to fail (because required binaries are missing etc).

Instead of a single mutex on the whole install.bash script, the script itself could leverage on parallel compilation (e.g., by applying an individual mutex for each Scheme system). This requires however some coordinated output buffering such that the outputs of different compilations are not arbitrarily intermingled.

Implemented and tested. The implementation introduces one mutex per Scheme system, such that different Scheme systems can install in parallel. It provides an online-updated installation table giving feedback about the progress of such parallel installations.