16.1 Introduction to processes

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" and is the current value of the variable mp:*current-process* . The current process continues to be executed until either it becomes a waiting process, by calling mp:process-wait or mp:process-wait-with-timeout , or it allows itself to be interrupted, by calling mp:process-allow-scheduling (or its current timeslice expires and it involuntarily relinquishes control).

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 mp:process-run-function . This creates a process with the specified name which commences by applying the specified function to arguments. mp:process-run-function returns immediately and the newly created process runs concurrently.

LispWorks User Guide - 11 Mar 2008