Processes

  • Multi-tasking capability available using threads (known as processes within SELF)

  • Create using a message object:
    	(message copy
    		receiver: 
    		Selector: ) fork
    

  • Every evaluation runs in a separate process.

  • Processes assigned fixed-size stack, started with a message

Processes

Self includes a multi-tasking capability, in the form of multiple threads within a single Self program. Each thread is a copy of process.

The easiest way to create a process programmatically is by sending fork to a message object:

	
	(message copy receiver: 100 Selector: 'factorial') fork

Every computation started from an evaluator runs in its own process. The user interface has several processes of its own.

In Self 4.0, each process's stack is of fixed-size, allocated when the process starts.

These are useful messages to a process:


    abort "kill the process"
    suspend "suspend until resumed"
    resume
    waitForSuspension "returns when the process suspends"
    waitForDeath "returns when the process dies"
    returnValue "the return value of a completed process"
    this "the currently executing process"

[ Previous ] [ Index ] [ Next ]