Normal multi-threaded applications should not need these the predicates from this section because almost any usage of these predicates is unsafe. For example checking the existence of a thread before signalling it is of no use as it may vanish between the two calls. Catching exceptions using catch/3 is the only safe way to deal with thread-existence errors.
These predicates are provided for diagnosis and monitoring tasks. See also section 8.5, describing more high-level primitives.
Linux has introduces POSIX threads (pthread) using an implementation called linuxthreads, where each thread was `almost' a process. This approach has various disadvantages, such as poor performance and non-compliance with several aspects of POSIX. However, there is one advantage. Where pthread does not provide a way to get statistics per thread, we could get this info from the process-oriented times() function. Since the 2.6.x kernels, Linux by default now uses the NPTL implementation which is POSIX compliant. Unfortunately, getting per-thread CPU statistics involves reading /proc and is therefore too slow for some applications.
SWI-Prolog is setup to run with the default thread model.
Unfortunately there is no way to modify this at runtime, but there is a
way to select the old thread model on modern machines at link time.
This is achieved using the environment variable LD_ASSUME_KERNEL
which must be set to a pre-nptl kernel version for linking the main
executable. The value 2.4.21
is appropriate. When building
from source, this flag can be set during the build process. When using a
binary distribution one could create a minimal C program and relink the
system using the plld utility.