[TUHS] Systematic approach to command-line interfaces

Douglas McIlroy douglas.mcilroy at dartmouth.edu
Mon Aug 2 12:42:53 AEST 2021


> spawn() beats fork()[;] fork() should be deprecated

Spawn is a further complication of exec, which tells what signals and
file descriptors to inherit in addition to what arguments and
environment variables to pass.

Fork has a place. For example, Program 1 in
www.cs.dartmouth.edu/~doug/sieve/sieve.pdf forks like crazy and never
execs. To use spawn, the program would have to be split in three (or
be passed a switch setting).

While you may dismiss Program 1 as merely a neat demo, the same idea
applies in parallelizing code for use in a multiprocessor world.

Doug


More information about the TUHS mailing list