5.1 About multitasking
deactivate-process
; the functionactivate-process
makes an inactive process active again.process-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:
nil
value, the process becomes runnable, its wait function is discarded, and the scheduler immediately passes control to it. No other wait functions are evaluated.nil
, the scheduler examines the next process.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:
process-allow-schedule
simply starts the scheduler.process-wait
,process-wait-forever
, andprocess-wait-with-timeout
associate a wait function with a process, mark the current process as waiting, and call the scheduler.Generated with Harlequin WebMaker