All Manuals > LispWorks User Guide and Reference Manual > 19 Multiprocessing


19.1 Introduction to processes

A process (sometimes called a thread) is a separate execution context. It has its own call stack and its own dynamic environment.

A process can be in one of three different states: running , waiting , and inactive . When a process is waiting , it is still active, but is waiting for the system to wake it up and allow its computation to restart. A process that is inactive has stopped, because it has an arrest "reason".

For a process to be active (that is, running or waiting), it must have at least one run reason and no arrest reasons. If, for example, it was necessary to temporarily stop a process, it could temporarily be given an arrest reason. However the arrest reason mechanism is not commonly used in this manner.

The process that is currently executing is termed "the current process". The function get-current-process gets the current process, and is the preferred way of doing so. The variable *current-process* is normally bound to the same process, except inside a wait function when it is called by the scheduler.

The current process continues to be executed until either it becomes a waiting process by calling a Process Wait function as described in Process Waiting and communication between processes, or it allows itself to be interrupted by calling process-allow-scheduling (or its current timeslice expires and it involuntarily relinquishes control).

In SMP LispWorks all processes that are not waiting are running as far as LispWorks is concerned, and are scheduled by the operating system to the available CPUs.

In non-SMP LispWorks, the system runs the waiting process with the highest priority. If processes have the same priority then the system treats them equally and fairly. This is called round robin scheduling.

The simplest way to create a process is to use process-run-function. This creates a process with the specified name which commences by applying the specified function to arguments. process-run-function returns immediately and the newly created process runs concurrently.

LispWorks User Guide and Reference Manual - 13 Feb 2015