Subject: Re: Regarding suspend(0) and lag

From: [email-masked]
Date: Mon, 22 Feb 1993 02:44:00 -0800

> Since the Lambda MOO server is non-premptive on task execution, it 
> implicitly relies on progammers to be nice and include "suspend(0);" or 
> such inside loops or breaking up secions of code to allow for smoother 
> operations. 

I confess I don't know quite what you mean here.  Spammy verbs will
generally require a suspend() of some sort, else run out of ticks and
die unhappily.  I would like to think that LambdaMOO implicitly relies
on programmers to write good code, as opposed to relying on them to 
properly handle spammy code.

> Have you checked the code on the LambdaCore for these?  

I think that
  $command_utils:suspend_if_needed()
is a quite suitable LambdaCore construct that doesn't actually put the
server to the trouble of suspending the task if it doesn't need to be
suspended.

> I remember something in one of your release otices about a new execution 
> style for suspend() instructions within the server.  Do they actually cost 
> a process any time?

Not that I'm a server hacker, but I believe this is correct.  I remember
reading somewhere that a suspended task starts with a fresh set of ticks 
(albeit a smaller set than a new task) and a new taskid.

> I'm considering just going stright through my MOO with a surgical hand and 
> adding a suspend(0); in EVERY verb that loops or takes any signifigant 
> time.  Anyone have any reasons I should not?

Sticking a suspend(0) in a spammy verb that has an unpleasant loop will
make that verb spam the MOO forever and ever.  IMO, suspend() should be
used sparingly when it's being used to save ticks (I favor the use of
$command_utils:suspend_if_needed for the preservation of ticks) and it 
should only be put in where it's -needed- -- not just everywhere.

Seth / Blackbriar