- ext
- clib
- socket.pl -- Network socket (TCP and UDP) library
- uid.pl -- User and group management on Unix systems
- unix.pl -- Unix specific operations
- syslog.pl
- filesex.pl -- Extended operations on files
- uri.pl -- Process URIs
- process.pl -- Create processes and redirect I/O
- time.pl -- Time and alarm library
- sha.pl -- SHA secure hashes
- crypt.pl
- memfile.pl
- uuid.pl -- Universally Unique Identifier (UUID) Library
- hash_stream.pl -- Maintain a hash on a stream
- md5.pl -- MD5 hashes
- streampool.pl -- Input multiplexing
- cgi.pl -- Read CGI parameters
- prolog_stream.pl -- A stream with Prolog callbacks
- udp_broadcast.pl -- A UDP broadcast proxy
- rlimit.pl
- clib
- process_set_method(+Method) is det
- Determine how the process is created on Unix systems. Method is one
of
spawn
(default),fork
orvfork
. If the method isspawn
but this cannot be used because it is either not supported by the OS or thecwd(Dir)
option is givenfork
is used.The problem is to be understood as follows. The official portable and safe method to create a process is using the
fork()
system call. This call however copies the process page tables and get seriously slow as the (Prolog) process is multiple giga bytes large. Alternatively, we may usevfork()
which avoids copying the process space. But, the safe usage as guaranteed by the POSIX standard ofvfork()
is insufficient for our purposes. On practical systems your mileage may vary. Modern posix systems also provideposix_spawn()
, which provides a safe and portable alternative for thefork()
andexec()
sequence that may be implemented usingfork()
or may use a fast but safe alternative. Unfortunatelyposix_spawn()
doesn't support the option to specify the working directory for the child and we cannot use working_directory/2 as the working directory is shared between threads.Summarizing, the default is safe and tries to be as fast as possible. On some scenarios and on some OSes it is possible to do better. It is generally a good idea to avoid using the
cwd(Dir)
option of process_create/3 as without we can useposix_spawn()
.