The library(unix) library provides the commonly used Unix primitives to deal with process management. These primitives are useful for many tasks, including server management, parallel computation, exploiting and controlling other processes, etc.
The predicates in this library are modelled closely after their native Unix counterparts.
- fork(-Pid) is det
- Clone the current process into two branches. In the child, Pid
is unified to child. In the original process, Pid is unified to
the process identifier of the created child. Both parent and
child are fully functional Prolog processes running the same
program. The processes share open I/O streams that refer to Unix
native streams, such as files, sockets and pipes. Data is not
shared, though on most Unix systems data is initially shared and
duplicated only if one of the programs attempts to modify the
fork()is the only way to create new processes and fork/1 is a simple direct interface to it.
The following predicates are exported, but not or incorrectly documented.