MOO-cows Mailing List Archive


Re: MOO and SMP Machines

On Tue, 25 Feb 1997, Peter Wright wrote:

> I think it might be easy to make an SMP MOO server, after all the MOO
> already uses processes internally.  I think you could get by with one main
> process that handles the inbound network connections, task management and
> checkpointing, and child processes that handle outbound network packets,
> and the computational work that the task requires.  

The LambdaMOO server implements it's own internal timeslicing, so a MOO
task is not really equivalent to an OS process.  I think the easiest way
to do this ("easy" being completely relative here) would be to spawn n
task execution engines on an n-processor machine and have the server
always run the next available task on the next available CPU.  Or perhaps
n-1 engines, reserving the first CPU for I/O and task management.

> All the processes would share the memory that the database is stored in.

Although you probably didn't notice, this is the major problem with your
idea. In the current LambdaMOO incarnation, only one task is executing at
a time.  Thus, to the programmer, there is an unstated guarantee that
" = + 1" will work as expected.  In an SMPed server, there
would be no such guarantees unless some explicit resource locking were
added to the MOO language.  This would, of course, be an unholy
complication to a fairly elegantly simple language.  Permissions are 
hard enough for newbie programmers.  Imagine trying to explain resource
management in the windup duck tutorial.

"But," I can hear you saying, "what if the locking was implemented in
such a way that it was transparent to the programmer?"  This is a
possibility, but one with its own pitfalls.  You could, for instance, lock
access to the entire shared memory segment to a single process.  If you
did this, however, there would be little point in an SMP server.  It's a
rare task that would not hang up early on waiting for access to the DB. 
Alternatively, you could lock the specific resources used by the task, but
that would require *determining* the specific resources used by the task.
This could be done, probably, with major modifications to either the
database structure or the code generator or both.

> Well I guess I've fallen from the question, is the moo server capable of
> handing out the internal processes to different CPUs on an SMP machine?

Well, obviously, not currently.  I admit I haven't been overly familiar 
with the guts of the server since 1.7.something, but I suspect giving it
this ability would still require some pretty significant changes.



Home | Subject Index | Thread Index