[MUD-Dev] Re: TECH: Distributed Muds

Chris Gray cg at ami-cg.GraySage.COM
Tue May 1 08:16:33 New Zealand Standard Time 2001

> From: "Kwon Ekstrom" <justice at softhome.net>
>> From: "Chris Gray" <cg at ami-cg.GraySage.COM>

>> In any case, do you really want to have no limit on softcode
>> execution?  No matter how many threads you give to your execution
>> system, if the bad softcode is hit enough, you are still in
>> trouble. Not only in the CPU usage, but possibly also in the memory
>> tied up and maybe even locks held.

> In the multi-threaded system, logging whenever softcode takes too
> much cpu time would be a better approach imho.  A timeout might
> work, but if you're in the middle of a delicate operation that
> modifies values that may be used by other computations, it could
> result in bad data being passed, and that IMHO would be worst than
> the cpu time.  Softcode's purpose is to allow parts of the game to
> be modified online, and bad code could be corrected somewhat easily
> (depending on circumstances of course)

I'm quite familiar with soft-code, since my system has 30,000 lines of
it.  I'm also familiar with using a timer to abort execution, since
that's what I do. The softcode execution isn't interrupted right on
the signal. Instead, a flag is set, which the softcode system checks
at regular intervals (e.g.  at the top of each iteration of a loop),
and it then shuts down cleanly based on that flag, returning error
values as appropriate. It also prints a run-time error message and a

Running out of time in softcode is a very exceptional
situation. Something is wrong when that happens. At least that's the
way I view it. Yes, it is possible for the softcode to leave some
world data structures in an inconsistent state when
interrupted. However, the way I have things set up, that won't bother
the hard-coded parts of the server, since the small amount of the
scenario structures that it depends on cannot get corrupted.  The
level at which the softcode executes is a higher one, and the
low-level server code isn't even aware of any data structures built at
that level.

Yes, this can mean that your MUD world is now corrupted and, like in
many such cases, that corruption can spread, and make the whole thing
unusable.  That's why I do periodic backups, and why I set the
softcode time limits quite high (seconds). That way, all legitimate
softcode has not trouble completing, but wayward code is caught. Oh
yes, softcode owned by the system administrator can temporarily raise
its run-time limit, for those things that legitimately take longer
(e.g. fractal terrain generation).

Don't design inefficiency in - it'll happen in the implementation.

Chris Gray     cg at ami-cg.GraySage.COM
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list