[MUD-Dev] Re: atomic functions

J C Lawrence claw at under.engr.sgi.com
Fri May 15 13:44:13 CEST 1998


On Wed, 13 May 1998 17:20:31 -5 
Jon A Lambert<jlsysinc at ix.netcom.com> wrote:

> On 13 May 98, J C Lawrence wrote:

>> On Wed, 6 May 98 22:59:33 MST Chris
>> Gray<cg at ami-cg.GraySage.Edmonton.AB.CA> wrote:

>> An object is "animated" because of an by an event chain.  Somewhere
>> back when, there was an "original" event which started the ball
>> rolling.  That event ran, compleated, and logged a new event.  That
>> one ran compleated, and logged a new event.  And in this manner, ad
>> infinitum thru time until the present, the events have
>> daisy-chained, each one created by the one before, jerk-stepping
>> the mobile thru virtual reality in seeming animation.

> In S&S, once an event is logged by an executing transaction, it
> becomes completely independent of it's parent event.  Thus failure
> of the parent event has no control over the execution of the child
> event.  Placement of events for intentional chaining in mudcode is
> critical.

Perhaps I should put a large red button on the chest of every mobile
with a "restart" label.  Umm, perhaps that should be a "Start" button
with a happy Mick Jagger tune when pressed?

In essence that is how the mobile will be initially animated anyway.

<ponder>

Simpler:

  Mobiles are animated by event chains. 

  It is possible to code events such that the probability of their
inability to execute is proximate to zero.  It is definitely possible
eo ensure that an event is executable by an otherwise "happy
(logically sound etc) system.  

  Ergo.  Just use a parallel watchdog event chain which periodically
checks up on the animation status of its ward mobile, and if missing,
reboots it.

Hurm.

SMMP -- Simple Monster^H^H^H^H^H^Hobile Monitoring Protocol.

Its not guaranteed, but it will work until your system gets *really*
ill.  It would be fairly simple to provide a third level of
indirection with a register of monitor event chainsa long with a
check-monitors and restart-monitors feature for error recovery.

>> What would happen if one of those events utterly failed to
>> compleat?  The mobile would die.  Nothing would log a "new" event
>> for that mobile; nothing would animate it.  There would be no
>> executing events to log future events to keep the process of change
>> going.  It would just sit there, utterly dead, until something
>> _external_ came along and changed it.

> Is this problematic with your intended handling of uncaught
> exceptions. 

Yes.

> In C&C it would appear your event chain would die, while in S&S the
> failed event would reschedule with the possibility of scheduling
> child events over and over.  Is there no happy medium here?  

I don't *think* so.  The only time this occurs for me is when the code
is physically unable to execute due to internal error or similar.

> The only reason I happen to prefer it this way, is that it is
> immediately and visually apparent through my process list command.
> It has nasty side-effects for server thrashing however.  

"Yeah, if things break the system becomes unusably slow," vs "Yeah, if
things break almost everything just turns off like the power had been
pulled, but you can still do things."

>> True.  I do this by keeping state variables in the mobile object
>> (acutally they are activity masks and are thus used to limit
>> possible simultaneous action).  Thus the digging chain, as you say,
>> runs in parallel with the "main" chain.  The main chain keeps
>> popping to life, checks for validity and mostly finds that its
>> inapplicable due to the digging chain and goes back to sleep by
>> logging a new future event.
>> 

> I suppose it is possible for a main/timer event to check on "dead"
> objects on a regular basis and reanimated them.  Does this solve the
> problem or just hide failures in the application event model?  Or is
> this simply a reincarnation of the Diku-esque big polling loop?
     
All three.  It hides the failures, reincarnates a polling loop under
the covers, and doesn't solve the problem.  Its a bandaide, but at
least with the advantage that it can be a really cheap bandaide (you
can run the state check every 30 minutes as vs every 30 seconds).

--
J C Lawrence                               Internet: claw at null.net
(Contractor)                               Internet: coder at ibm.net
---------(*)                     Internet: claw at under.engr.sgi.com
...Honourary Member of Clan McFud -- Teamer's Avenging Monolith...
On Wed, 13 May 1998 17:20:31 -5 
Jon A Lambert<jlsysinc at ix.netcom.com> wrote:

> On 13 May 98, J C Lawrence wrote:
>> On Wed, 6 May 98 22:59:33 MST Chris
>> Gray<cg at ami-cg.GraySage.Edmonton.AB.CA> wrote:
>> 
>> > [J C Lawrence:]
>> 
>> >> What if this event daisy chain didn't start from a user command,
>> >> but was generated by a mobile attempting its normal business of
>> >> wandering the land?  If the event chain dies with that failed
>> event >> the mobile itself "dies" -- there are no more events to
>> "animate" >> it.
>> 
>> > Why must it die?
>> 
>> There's some underlieing logic going on that mandates this: (I
>> expect you know this already from the discussions on this area a
>> little over a year ago).
>> 
>> Events are the ONLY things that are capable of logging new events.
>> Translation: A successfully executed event is the only thing
>> capable of causing another event to be executed in the future.
>> 

> Note that I handle this conceptually similar to you and will list
> the notable differences.

>> An object is "animated" because of an by an event chain.  Somewhere
>> back when, there was an "original" event which started the ball
>> rolling.  That event ran, compleated, and logged a new event.  That
>> one ran compleated, and logged a new event.  And in this manner, ad
>> infinitum thru time until the present, the events have
>> daisy-chained, each one created by the one before, jerk-stepping
>> the mobile thru virtual reality in seeming animation.

> In S&S, once an event is logged by an executing transaction, it
> becomes completely independent of it's parent event.  Thus failure
> of the parent event has no control over the execution of the child
> event.  Placement of events for intentional chaining in mudcode is
> critical.

>> What would happen if one of those events utterly failed to
>> compleat?  The mobile would die.  Nothing would log a "new" event
>> for that mobile; nothing would animate it.  There would be no
>> executing events to log future events to keep the process of change
>> going.  It would just sit there, utterly dead, until something
>> _external_ came along and changed it.
>> 

> Is this problematic with your intended handling of uncaught
> exceptions. In C&C it would appear your event chain would die, while
> in S&S the failed event would reschedule with the possibility of
> scheduling child events over and over.  Is there no happy medium
> here?  The only reason I happen to prefer it this way, is that it is
> immediately and visually apparent through my process list command.
> It has nasty side-effects for server thrashing however.  I have been
> thinking of only rescheduling on uncaught LOCK_FAIL exceptions.
> This would be similar to C&C's rescheduling on "Compare" failures.
> Still it is not a complete solution, although a safer one.

>> Yes, you could do multiple and parallel event chains as you discuss
>> below.  But what happens if the "master" chain dies?  Do you have a
>> watchman chain whose only purpose is to ensure that there is a
>> valid running master chain?  What if the watchman dies?
>> 
>> This is thorny problem -- solvable, but not elegant.
>> 
>> > From a naive point of view, you want it to stop digging the canal
>> > because something prevented it from continuing. The digging event
>> > chain doesn't have to be the only event chain that exists for the
>> > NPC. It could have a normal chain, that, because it is currently
>> > digging, doesn't do things like wandering away, but can still do
>> > things like poses, simple interactions with PC's, etc. The
>> question > then becomes that of how the main chain knows that the
>> dig chain has > terminated.
>> 

> This particular task does not sound to me like an atomically
> consistent transaction because it is a task that can be at an analog
> state.  Thus the event chain should be breakable, through external
> state changes.  Upon breaking the chain an event should be logged to
> message Bubba indicating that his digging had been interrupted, yet
> NOT rolled back.  On an animated NPC an event should be logged to
> cause the NPC to make a decision on future activities, which may end
> up with the resumption of digging or starting some other chain of
> events (e.g. gathering wood ala Warcraft) or going to sleep and
> stopping to eat.  :)

>> True.  I do this by keeping state variables in the mobile object
>> (acutally they are activity masks and are thus used to limit
>> possible simultaneous action).  Thus the digging chain, as you say,
>> runs in parallel with the "main" chain.  The main chain keeps
>> popping to life, checks for validity and mostly finds that its
>> inapplicable due to the digging chain and goes back to sleep by
>> logging a new future event.
>> 

> I suppose it is possible for a main/timer event to check on "dead"
> objects on a regular basis and reanimated them.  Does this solve the
> problem or just hide failures in the application event model?  Or is
> this simply a reincarnation of the Diku-esque big polling loop?
     
 
> -- --/*\ Jon A. Lambert - TychoMUD Internet:jlsysinc at ix.netcom.com
> /*\-- --/*\ Mud Server Developer's Page
> <http://www.netcom.com/~jlsysinc> /*\-- --/*\ "Everything that
> deceives may be said to enchant" - Plato /*\--

> -- MUD-Dev: Advancing an unrealised future.

--
J C Lawrence                               Internet: claw at null.net
(Contractor)                               Internet: coder at ibm.net
---------(*)                     Internet: claw at under.engr.sgi.com
...Honourary Member of Clan McFud -- Teamer's Avenging Monolith...

--
MUD-Dev: Advancing an unrealised future.



More information about the mud-dev-archive mailing list