1997Q3/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev]  C&#38;C and Event Rescheduling -->
<!--X-From-R13: "Xba O. Znzoreg" <wyflfvapNvk.argpbz.pbz> -->
<!--X-Date: from stimpy.globecomm.net [207.51.48.4] by in1.ibm.net id 869839892.54446&#45;1 Fri Jul 25 14:11:32 1997 CUT -->
<!--X-Message-Id: 199707251411.JAA01418@dfw&#45;ix2.ix.netcom.com -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev]  C&amp;C and Event Rescheduling</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:jlsysinc#ix,netcom.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00239.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00241.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00245.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00243.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00240">Author</A>
&nbsp;|&nbsp;<A HREF="#00240">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00240">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev]  C&amp;C and Event Rescheduling</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: &lt;<A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A>&gt;</LI>
<LI><em>Subject</em>: Re: [MUD-Dev]  C&amp;C and Event Rescheduling</LI>
<LI><em>From</em>: "Jon A. Lambert" &lt;<A HREF="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</A>&gt;</LI>
<LI><em>Date</em>: Fri, 25 Jul 1997 10:11:54 -0400</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
&gt; From: clawrenc#cup,hp.com
&gt; Subject: [MUD-Dev]  C&amp;C and Event Rescheduling
&gt; 
&gt; In &lt;<A HREF="msg00200.html">33CFCE6E.41C67EA6#iname,com</A>&gt;, on 07/18/97 
&gt;    at 01:22 PM, Shawn Halpenny &lt;malachai#iname,com&gt; said:
&gt; 
&gt; &gt;Yep, a slight change is necessary.  Now (and again, roughly): 
&gt; &gt;1.  A client C requests object O from the database. 
&gt; &gt;2.  Add C to list of clients using O. 
&gt; &gt;3.  Return OC (a client-only copy of O) to C. 
&gt; &gt;4.  A client D (which may or may not be the same as C, but is on the
&gt; &gt;    using-list for O) returns OC'. 
&gt; &gt;5.  If O has not changed since D's request for it (a different client
&gt; &gt;    may have committed changes to O while D was processing), OC' is
&gt; &gt;    atomically committed to the database, replacing O.  D is removed 
&gt; &gt;    from O's using-list.
&gt; &gt;6.  If O has changed since D's request for it, OC' is discarded and D
&gt; &gt;    receives notification that OC' couldn't commit.
&gt; &gt;7.  Clients in the using-list for O are asynchronously notified that
&gt; &gt;    O has changed. 
&gt; 
&gt; Given that this basic pattern extend to all the objects which comprise
&gt; a given event or transaction, this is identical in principle to my
&gt; model.
&gt;

This might be accomplished by separating methods into event methods 
and regular methods.  A regular method is never called by the event 
manager since it isn't a logical transaction, while an event method 
forms an application consistent transaction.  Upon termination of an 
event method an implicit commit is done.  This should allow nested 
transactions as a side effect of nested event method calls as long 
as commits are delayed to the callers termination.
 
&gt;   There is reason behind all this madness:  It reduces the number of
&gt; data copies needed for transactions.  By using this sort of layered
&gt; scheme I manage to delay making a copy of the object until I
&gt; absolutely need one (ie someone has attempted to modify the object). 

On further thought, the amount of object copies doesn't bother me
to much as a performance issue.  Many well-optimized locking DBs do 
this as a matter of integrity.  The wasted time and possible race
conditions in event rescheduling vs. wasted time waiting on "a lock" 
and possible deadlocks do bother me.  I can't really make an informed 
guess as to which is better.  Some heavy duty profiling is probably
in order.   

&gt; 
&gt;   Re: #5.  How do you determine that the object has changed during the
&gt; execution of the event?  I do this by always keeping an original copy
&gt; of the object to compare to the copy current in the DB and then do a
&gt; bit-wise comparison of the two objects.  The original copy is the
&gt; second copy made above for a modification.
&gt; 
&gt;   Aside: I'm actually getting *slightly* neater than this as the
&gt; current plan encludes only making a copy of the object
&gt; attribute/member which is changed, and then only comparing that at
&gt; C&amp;C.

The burdens of attribute detection are difficult.  How does
one detect the difference between:

ObjectA method ()
{
   x = ObjectB.attrX;      // a direct reference
   y = ObjectB.GetattrY(); // an indirect reference through accessor
                           // perhaps a derived attribute?  
}


Another possibility is for the DB manager to push the requesting
events unique handle onto an interested parties list along with a 
CRC.  Upon an attempt to commit, you compare the stored event handle's 
CRC to real objects CRC.  Problem: How reliable is CRC-32/64?  
Worst case: the 1 in 32 billion(?) burp causes an invalid pointer 
reference followed by a big thump.  On reboot and reload of DB 
the invalid object reference is ideally gracefully groked.  
Another issue:  A performance judgment on CRC calculation vs. 2nd object 
copy with memory/bitwise comparison.


&gt; 
&gt; Concern:
&gt; 
&gt;   An event generated IO.  How do you handle when it reschedules? 
&gt; Think about things like SAY, TELL, LOOK, etc for example cases.
&gt; 

You also mention somewhere below about how some objects undergoing
a state change will propagate/generate events (likely asynchronously).
I see these objects being very similar and/or handy with IO.
Maybe it's possible for either the DB manager or the VM to post
the object state change events to the event scheduler after the 
point of a successful transaction commit.
This might require another special method/object language construct.  
It would handle indirect state changes as long as the room container
is the primary propagator.  And yes, even a temporary "neighborhood"
object could be born from the commit and die at the end of it's
state change method *boggle*
A global CHAT object could then spawn gobs of events during its
cycle through the world.  

&gt; Okay, 50 players in a room all moving west is unlikely.  How about 50
&gt; players in or near a room, some moving out the various doors, some
&gt; coming back into the room having left, others picking up or dropping
&gt; various objects (changes to the contents lists), Every single event is
&gt; now compeating for the chance to get a single unmodified copy of that
&gt; room when it C&amp;C's.  
&gt; 
&gt; Now that I've cast doom and gloom.  This need not be a huge problem. 
&gt; The fix is to change the manner in which you write
&gt; events/transactions.  The requirement is to split events into the
&gt; smallest, fastest executing,  logically consistant units you can.  The
&gt; idea is that by making the runtime of an individual event as short oas
&gt; possible the chance of collision by other events is minimised. 
&gt; Further, by making the runtime short, the probability is that what a
&gt; given event sequence contends with on its first step will not be
&gt; contended for on its next step.  eg:
&gt;

You could go to a pure event model, where ALL method references are
considered object messages which are dispatched as events.  I have
doubts whether any sort of application transactional integrity
could be easily achieved with this approach, unless there is a strong
in language mechanism in place.   ala StartTransaction-EndTransaction.
This takes the implicit nature of persistence out of the language.
Blech...IMO implicity==simplicity for the potential mudlib coder.

[execution priority and starvation trimmed]

I need to look at this closer. 
I agree with most of this conceptually. =)



JL


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00279" HREF="msg00279.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></strong>
<ul compact><li><em>From:</em> clawrenc#cup,hp.com</li></ul>
<li><strong><A NAME="00243" HREF="msg00243.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></strong>
<ul compact><li><em>From:</em> Shawn Halpenny &lt;malachai#iname,com&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00239.html">Re: [MUD-Dev] Motivating people</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00241.html">Re: [MUD-Dev] Multi-threaded programming under Linux</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00245.html">Re: [MUD-Dev] OT: Multi-threaded programming under linux</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00243.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00240"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00240"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev]  Stories?</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<LI><strong><A NAME="00251" HREF="msg00251.html">Re: [MUD-Dev]  Stories?</A></strong>, 
Matt Chatterley <a href="mailto:root#mpc,dyn.ml.org">root#mpc,dyn.ml.org</a>, Sun 27 Jul 1997, 21:33 GMT
</LI>
</ul>
<LI><strong><A NAME="00273" HREF="msg00273.html">Re: [MUD-Dev]  Stories?</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Wed 30 Jul 1997, 00:49 GMT
</LI>
</ul>
</LI>
<LI><strong><A NAME="00244" HREF="msg00244.html">Re: [MUD-Dev] Multi-threaded programming under Linux]</A></strong>, 
Michael Hohensee <a href="mailto:michael#sparta,mainstream.net">michael#sparta,mainstream.net</a>, Sat 26 Jul 1997, 02:40 GMT
<UL>
<LI><strong><A NAME="00245" HREF="msg00245.html">Re: [MUD-Dev] OT: Multi-threaded programming under linux</A></strong>, 
Orion Henry <a href="mailto:ohenry#sdcc10,ucsd.edu">ohenry#sdcc10,ucsd.edu</a>, Sat 26 Jul 1997, 06:19 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00240" HREF="msg00240.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Fri 25 Jul 1997, 21:11 GMT
<UL>
<LI><strong><A NAME="00243" HREF="msg00243.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Sat 26 Jul 1997, 00:48 GMT
<UL>
<LI><strong><A NAME="00246" HREF="msg00246.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></strong>, 
Miroslav Silovic <a href="mailto:silovic#srce,hr">silovic#srce,hr</a>, Sun 27 Jul 1997, 00:42 GMT
<UL>
<LI><strong><A NAME="00274" HREF="msg00274.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Wed 30 Jul 1997, 01:10 GMT
<UL>
<LI><strong><A NAME="00289" HREF="msg00289.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></strong>, 
Miroslav Silovic <a href="mailto:silovic#petra,zesoi.fer.hr">silovic#petra,zesoi.fer.hr</a>, Wed 30 Jul 1997, 20:43 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>