5.1 About multitasking

5.1.2 Process scheduling

An alive process is one that is either active or inactive.

A dead process is one that has been killed or has run to completion. An active process is runnable unless it is associated with a wait function. A wait function is a function that is evaluated by the scheduler to determine whether a process can be run. You can use the functionsprocess-wait,process-wait-forever, orprocess-wait-with-timeout to associate a wait function with a process. You can also create a process in a waiting state by using the:wait-function option to the functionmake-process. The functionprocess-wait-function returns the wait function of a process, and the functionprocess-wait-arguments returns its arguments.

Every process has a priority. Active processes are kept on a queue that is sorted by priority. Processes with higher priority appear at the front of the queue.

The scheduler simulates concurrent execution of processes by periodically passing control from one process to another. It examines each process in order of priority and takes the appropriate action:

Before a process is run, it is moved back in the queue beyond any other process with the same priority. In other words, processes with the same priority run with round-robin scheduling.

The wait function is evaluated in the dynamic context of the process that is current when the scheduler is entered. Scheduling is inhibited while the wait function runs to prevent recursive invocations of the scheduler. If the wait function fails to terminate when the scheduler invokes it, Lisp will hang.

The scheduler is called automatically at the end of the scheduling quantum, or you can invoke it with the following functions:


The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker