1998Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: atomic functions -->
<!--X-From-R13: Eunja Vnycraal <znynpunvNvanzr.pbz> -->
<!--X-Date: Sat, 5 May 1998 07:32:51 &#45;0700 -->
<!--X-Message-Id: 19980505170101.C8490#sun104,humb.nt.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 9805031634.8x4v@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: atomic functions</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:malachai#iname,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="msg00398.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00400.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00344.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00410.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00399">Author</A>
&nbsp;|&nbsp;<A HREF="#00399">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00399">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: atomic functions</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: [MUD-Dev] Re: atomic functions</LI>
<LI><em>From</em>: Shawn Halpenny &lt;<A HREF="mailto:malachai#iname,com">malachai#iname,com</A>&gt;</LI>
<LI><em>Date</em>: Tue, 5 May 1998 17:01:01 -0400</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Sender</em>: "Petidomo List Agent -- Kanga.Nu version" &lt;<A HREF="mailto:petidomo#kanga,nu">petidomo#kanga,nu</A>&gt;</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Sun, May 03, 1998 at 09:34:56AM -0700, Chris Gray wrote:
&gt; [Jon A. Lambert:]
&gt; 
&gt; I'm following up to Jon, but not directly responding.
&gt; 
&gt; An early morning (and perhaps foggy) thought I just had is this:
&gt; 
&gt; Suppose you let the system handle all of the atomicity, by making all events
&gt; completely atomic, regardless of how much they do internally. What is the
&gt; downside? Well, one big downside could be that if the event ends up doing
&gt; too much, it could continually be failing C&amp;C if other things are going on.
&gt; However, if the event is doing a lot, there are likely lots of sub-events
&gt; within it, that can be atomic, and can complete even if the entire main
&gt; event doesn't. So, rather than having constructs that are required to get
&gt; atomicity, why not have atomicity be the default, and have constructs that
&gt; allow you to relax the atomicity? Something as simple as a 'commit'
&gt; statement, marking the boundary between sequences required to be atomic.
&gt; 
&gt; So what would happen with code like this:
&gt; 
&gt;     nonatomic event() {
&gt;         phase1();
&gt;         commit;
&gt;         phase2();
&gt;     }
&gt; 
&gt; This could only be done if 'phase1' leaves everything in a consistent state.
&gt; If 'phase1' has been completed successfully, the internal progress status of
&gt; the event is updated (from 0 to 1, say). Then, if 'phase2' fails to C&amp;C, and
&gt; the event is retried, it will restart from 'phase2'.
&gt; 
&gt; Hmm. I guess one could argue that anything like this is really just syntactic
&gt; sugar, since you could rewrite it as:
&gt; 
&gt;     phase2event() {
&gt;          phase2();
&gt;     }
&gt; 
&gt;     event() {
&gt;         phase1();
&gt;         schedule event phase2event;
&gt;     }
&gt; 
&gt; Would this even be worth considering?

Yep.  This is related to the sub-thread from a while back about ensuring
event output gets to the users in correct order, event-sequencing, and
all that.  It's how I'm planning to handle it.

The idea was to take an event that touches a lot of objects (say, a
message written to every player), break it up into smaller events that
touch fewer objects and process those events in some order, to prevent
this large event from repeatedly failing to C&amp;C (and eventually forcing
the server to single-thread until it completed).  Felix' atomic
functions would seem to handle this, but I think the function author
would have to explicitly mark the atomic sections properly.

I want a method to do this without having to write the code in a special way,
though:  I don't want the scriptor to have to think about breaking his "add
10 to the max_damage of every adamantine sword whose name begins with the
letter 'Q'" event into a chain of events (one per sword, by the time all is
said and done), just to make sure that an update of that breadth will
commit in timely fashion.  Roughly, I want the scriptor to be able to
write something like:

function foo()
{
	foreach obj (obj_in_world.type == "admantine sword")
	{
		... some stuff ...

		obj.max_damage += 10;

		... more stuff ...
	}
}

and not have the server handle foo() single-threadedly.

Is breaking that loop into an event chain as simple as scheduling an event to
execute the guts of the loop on each iteration?  I think you'd still end up
with a lot of failed C&amp;C's as those new events ripened, since the
foo() event hasn't completed looping yet.

Would the effect be less drastic if the attributes were stored as distinct
objects in the DB, rather than considering mud objects as the base storage
unit?  That way, the only time C&amp;C would fail is if some other event had
touched the exact same attribute, as opposed to just touching the object.
(I'm particularly hoping someone (like JCL!) will have tried something like
that and can feedback here).

-- 
Shawn Halpenny

I know that you believe you understand what you think I said, but,
I am not sure you realize that what you heard is not what I meant.  

-- 
MUD-Dev: Advancing an unrealised future.

</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="00410" HREF="msg00410.html">[MUD-Dev] Re: atomic functions</A></strong>
<ul compact><li><em>From:</em> Adam Wiggins &lt;adam#angel,com&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00338" HREF="msg00338.html">[MUD-Dev] Re: atomic functions</A></STRONG>
<UL><LI><EM>From:</EM> cg#ami-cg,GraySage.Edmonton.AB.CA (Chris Gray)</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00398.html">[MUD-Dev] Re: FW: (Fwd) Bouncing mail</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00400.html">[MUD-Dev] Re: (fwd) Re: POLL: Games ruined by bad players (Player killers, tank rushers etc)</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00344.html">[MUD-Dev] Re: atomic functions</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00410.html">[MUD-Dev] Re: atomic functions</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00399"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00399"><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>[MUD-Dev] Re: atomic functions</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00335" HREF="msg00335.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Sat 02 May 1998, 23:26 GMT
<UL>
<LI><strong><A NAME="00336" HREF="msg00336.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sun 03 May 1998, 05:49 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00338" HREF="msg00338.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 03 May 1998, 17:16 GMT
<UL>
<LI><strong><A NAME="00344" HREF="msg00344.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sun 03 May 1998, 15:19 GMT
</LI>
<LI><strong><A NAME="00399" HREF="msg00399.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Tue 05 May 1998, 14:32 GMT
<UL>
<LI><strong><A NAME="00410" HREF="msg00410.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Adam Wiggins <a href="mailto:adam#angel,com">adam#angel,com</a>, Tue 05 May 1998, 19:18 GMT
<UL>
<LI><strong><A NAME="00411" HREF="msg00411.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Adam Wiggins <a href="mailto:adam#angel,com">adam#angel,com</a>, Tue 05 May 1998, 19:33 GMT
</LI>
<LI><strong><A NAME="00457" HREF="msg00457.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Thu 07 May 1998, 14:09 GMT
<UL>
<LI><strong><A NAME="00542" HREF="msg00542.html">[MUD-Dev] Re: atomic functions</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Wed 13 May 1998, 18:23 GMT
</LI>
</UL>
</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>