Go to the first, previous, next, last section, table of contents.


Using Tasks

A task is an execution of a MOO program. There are three ways for tasks to be created in LambdaMOO:

To prevent a maliciously- or incorrectly-written MOO program from running forever and monopolizing the server, limits are placed on the running time of every task. One limit is that no task is allowed to run longer than one minute; this limit is, in practice, never reached. The reason is that there is a second limit on the number of operations a task may execute. Every task has an associated clock that counts down ticks as the task executes. The server counts one tick for every expression evaluation (other than variables and literals) and one for every time through the body of a loop. If a task's clock winds all the way down to zero, the task is immediately and unceremoniously aborted. Command and server tasks are given brand-new clocks with an initial store of 20,000 ticks; this is enough for almost all normal uses. A forked task inherits the clock of the task that forked it, with however many ticks remain on it. To allow objects like cuckoo clocks and other recurring tasks that do a little bit of work every once in a while forever, clocks also regain ticks at the rate of 25 ticks per second, up to the maximum of 20,000 ticks. The seconds are counted from the end of the time that one task was counting down that clock to the time when the next user of that clock actually begins execution. Because forked tasks may exist for long periods of time before they begin execution, there are commands to list the ones that you own and to kill them before they execute. These commands are covered in the following section.

Command: @forked
Gives a list of all of the forked tasks you own, along with detailed information about each one. The information includes the following:
Queue ID:
A numeric identifier for the task, for use in killing it .
Start Time:
The time after which the task will begin execution.
Owner:
You, if you're not a wizard.
Clock:
The number of ticks left on the clock for the task right this moment; if the task does not execute immediately, this number will grow, up to a maximum of 20,000 ticks.
Clock ID:
It is possible for several tasks to share a single clock. The clock ID is a numeric identifier for each clock, so that you can tell if one is being shared.
Verb:
The object and verb-name of the code that forked the task.
Line:
The line number of the first statement that the task will execute when it starts. Note that the code for the verb in question may have changed since the task was forked; the forked task will use the version that was being executed when it was forked.

Command: @kill queue-id
Immediately kills the forked task with the given numeric queue ID. The `@forked' command is useful for finding out these queue IDs. Only the owner of a task may kill it.


Go to the first, previous, next, last section, table of contents.