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
. The current process continues to be executed until either it becomes a waiting process, by calling
, or it allows itself to be interrupted, by calling
(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
. This creates a process with the specified name which commences by applying the specified function to arguments.
returns immediately and the newly created process runs concurrently.