MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

RE: Couple of Questions



Your question is somewhat confusing, but as far as I can tell you're saying you have a routine that calls x:regen() and x:action() in all the children of $15711 once a minute for 20 minutes, and that x:action() also performs some time-delay operation with a suspend(someseconds) itself, correct?

Given:

#15711:call_regen()                      this:action()
for x in [1..20]                               for x in [1..20]
  for y in (children(#15711))             do something...
    y:regen();                                     suspend(60);
    y:action();                                 endfor
  endfor
  suspend(60);
endfor

In this example, this:action() won't return control to call_regen() for 20 minutes, because all of this is done without forking, in which case it is processed linearly, so x:regen() and y:regen() ends up getting called once every 21 minutes, and the whole process takes 420 minutes.


However, if you do this:

#15711:call_regen()                      this:action()
for x in [1..20]                               for x in [1..20]
  for y in (children(#15711))             ...do something...
    fork (0)                                        suspend(60);
      y:regen();                                endfor  
      y:action();
    endfork
    suspend(60);
endfor

Then :call_regen() forks a seperate task which goes off and calls y:regen() and y:action(), then goes to sleep for a minute, before doing it again.  Meanwhile this:action() is going to take 20 minutes to do its work, so the next loop through call_regen() is going to spawn /another/ call to this:action(), so now you have two copies of  this:action() running, on the 3rd pass you may have 3 actions (all depending on how long this:action() suspend()'s.)

So if this:action() is doing something that takes less than a minute this second method is probably going to work just fine for you, but if it's going to take longer than a minute you may want to introduce some flags into the routines to decide whether or not to fork the task based on whether a copy of it is already running or not. 


----------
From:  Muddy Waters[SMTP:muddy@emi.net]
Sent:  Monday, February 19, 1996 5:17 PM
To:  moo-cows.PARC@xerox.com
Subject:  Couple of Questions

Hello,

I have been saving up a couple of questions that I just can't seem to answer
on my own.

Okay, first one:

I have a verb that looks roughly like this....

@verb #15711:call_regen()

rooms = children(#15711);
timer = 20;
while (timer > 0)
  for x in (rooms)
    x:regen();
    x:action();
  endfor
  suspend(60);
  timer = timer + 1;
endwhile


It does what I want it to with regen() (which is call the verb regen() and
action() in every room that is a child of #15711 every minute for 20
minutes) But for action() it doesn't.  action() is very similar to the above
verb in that is has the same while statements to cause a timer affect.  So,
if action() takes a while and uses suspend() also, it messes up the timing
of call_regen().  Any way to prevent this?

Okay, Second one:

This may be more of a Linux question, but in relation to MOOs (I think).  I
am attempting to install the Slackware version of Linux on my pentium
100mhz, 16RAM machine.  I want to eventually get a MOO up and running on it.
I belive I can accomplish these goals, but...I want to allow others to
access it as well.  I only have a PPP account that I would only be able to
use on nights and weekends.  I have heard of programs that will 'listen' on
other ports and direct connections to the current ip address that is set up
everytime I connect with my ppp account.  Is this all I need? or is there
more? Will the MOO start up correctly not being in single user mode if this
is all I have? and where can I get what I need?

last question, I promise 8)

Okay, this is more of a request than a question, but if anyone knows of a
site for a small role playing MOO that lost it's site a few months ago,
please let me know.  My db file is about 3megs so up and running and with
the server would take up 11megs of space.  Very few people log on (probably
3-4 at one time is unusual), it is more in the building stages than anything
else right now.  Contact me for more details about the theme and policies.

Thanks a lot

Elisabeth
Four Seasons MOO
A role playing game &
Internet Tutorial







Home | Subject Index | Thread Index