1998Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: atomic functions -->
<!--X-From-R13: "Tryvk O. Qebrf" <sryvkNkf1.fvzcyrk.ay> -->
<!--X-Date: Wed, 6 May 1998 12:37:14 &#45;0700 -->
<!--X-Message-Id: 199805061934.VAA10168#xs1,simplex.nl -->
<!--X-Content-Type: text/plain -->
<!--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:felix#xs1,simplex.nl">
</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="msg00432.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00434.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00464.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00459.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00433">Author</A>
&nbsp;|&nbsp;<A HREF="#00433">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00433">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>: "Felix A. Croes" &lt;<A HREF="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</A>&gt;</LI>
<LI><em>Date</em>: Wed, 6 May 1998 21:34:27 +0200 (MET DST)</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>
J C Lawrence &lt;claw#under,engr.sgi.com&gt; wrote:

&gt; On Thu, 30 Apr 1998 03:59:20 +0200 (MET DST) 
&gt; Felix A Croes&lt;felix#xs1,simplex.nl&gt; wrote:
&gt;[...]
&gt; &gt;     An atomic function is a function that succeeds or fails as a
&gt; &gt; whole.  Any runtime error that is not caught within the function
&gt; &gt; will lead to the entire function call, with all its effects and
&gt; &gt; side-effects, being undone.
&gt;
&gt; &gt; Atomic functions would be used to enforce consistency -- just like a
&gt; &gt; thread either fails or succeeds without leaving the mud in an
&gt; &gt; inconsistent, half-completed state.  Of course, every function
&gt; &gt; called at the beginning of a thread is effectively called
&gt; &gt; atomically, so code that depends on atomic functions can be replaced
&gt; &gt; by code that depends on (atomic) threads.  The advantage of atomic
&gt; &gt; functions would be to place the function call within the wider
&gt; &gt; thread context, which would be similar to imposing an execution
&gt; &gt; order on threads.  Also, calls to atomic functions could be nested.
&gt;
&gt; Hurm.  I'm not entirely sure I understand.  Would this be a correct
&gt; re-phrasing?  
&gt;
&gt;   An atomic function is a member of a special class of functions which
&gt; may be called from an executing event, but whose pass/fail result are
&gt; reported back to the caller as vs re-entering the C&amp;C mechanism.

While the handling of an atomic function failure is almost identical
to that of event failure under C&amp;C, the &lt;meaning&gt; is not: the function
failed due to a runtime error.  This is only similar to event failure
if events, also, can be undone by a runtime error.  Because of this,
I prefer not to define atomic functions in C&amp;C event terms.


&gt; Note however that the *ONLY* possible use for such a function is to be
&gt; able to call it from an executing event, have it FAIL, and continue
&gt; execution of the event despite the failure.  Why is this is only
&gt; possible use?  Because if the function succeeds (the only other
&gt; possible return state of a function at this level), then there is no
&gt; effective difference between the execution pattern of such an "atomic
&gt; function" and any other form.  It is only in the FAIL state that the
&gt; execution pattern is different.
&gt;
&gt; Delving futher into the FAIL state semantics, if the caller is to also
&gt; FAIL because of the atomic function's failure, then the only gain from
&gt; the atomic function overhead is is that it may get earlier
&gt; notification of its impedending C&amp;C failure via the atomic function
&gt; than it would have otherwise.  This can be a notable performance
&gt; enhancement, but comes at significant cost in complexity of the
&gt; execution environment (which is now heirarchial as vs flat) and in
&gt; code.  Additionally the benefit is only gained for callers of atomic
&gt; functions -- all other events suffer the penalty of the more complex
&gt; environment without any gain.  

In my design, events are only cancelled if they fail to commit their
changes.  Uncaught errors cause the event to terminate, but do not
make it skip the commit phase.

Aside: an event that fails a number of times will eventually be
rescheduled in (effective) single-threaded mode.  Thus, it is not
possible for scheduled events to disappear altogether, and the
temporary failure of events is invisible from within the system.

Note that calling the execution environment `flat' is slightly
misleading.  It is flat, but not &lt;utterly&gt; flat -- without atomic
functions there are still two layers.  Per my design, the only
penalty associated with atomic functions is in the copying of data
required when they are being executed.  This is precisely what
happens when data is normally being accessed by an event in a C&amp;C
environment, and indeed, the code makes no distinction.


&gt; It is only when the calling function is intended to continue execution
&gt; despite the failure of the atomic function (at the C&amp;C level), that
&gt; the execution pattern is different.  However the functional gain here
&gt; I find (and found, I implemented somethign like this for a while)
&gt; to be illusionary.  There just is no practical use for the feature.

I contest this :)  I claim that it is very useful indeed, and not
at all illusionary.  I frequently find that actions which have to
be atomic -- for instance, moving a hungry dragon into a room,
which changes both the environment of the dragon and the inventory
of the room -- are part of a larger event, the actions of which
I want to be executed precisely in that other without other
events intervening.


&gt;   Note: ColdC has a similar construct with their exception handling
&gt; model (Miro or Brandon can probably expand better than I there).

Critical sections in ColdC?  I looked it up, and there does not
appear to be any undoing of changes involved.

Felix Croes

-- 
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="00511" HREF="msg00511.html">[MUD-Dev] Re: atomic functions</A></strong>
<ul compact><li><em>From:</em> J C Lawrence &lt;claw#under,engr.sgi.com&gt;</li></ul>
<li><strong><A NAME="00459" HREF="msg00459.html">[MUD-Dev] Re: atomic functions</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="msg00432.html">[MUD-Dev] Re: Some thoughts on languages and users - was: Ma</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00434.html">[MUD-Dev] Re: PK and my "Mobless MUD" idea</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00464.html">[MUD-Dev] Re: atomic functions</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00459.html">[MUD-Dev] Re: atomic functions</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00433"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00433"><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>
<ul compact>
<LI><strong><A NAME="00388" HREF="msg00388.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Joel Dillon <a href="mailto:emily#cornholio,new.ox.ac.uk">emily#cornholio,new.ox.ac.uk</a>, Tue 05 May 1998, 07:17 GMT
<UL>
<LI><strong><A NAME="00557" HREF="msg00557.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Wed 13 May 1998, 21:32 GMT
</LI>
</UL>
</LI>
</ul>
<LI><strong><A NAME="00386" HREF="msg00386.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Tue 05 May 1998, 06:25 GMT
<UL>
<LI><strong><A NAME="00464" HREF="msg00464.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>, Thu 07 May 1998, 22:58 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00433" HREF="msg00433.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Wed 06 May 1998, 19:37 GMT
<UL>
<LI><strong><A NAME="00459" HREF="msg00459.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:12 GMT
<UL>
<LI><strong><A NAME="00558" HREF="msg00558.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Wed 13 May 1998, 21:41 GMT
<UL>
<LI><strong><A NAME="00584" HREF="msg00584.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Thu 14 May 1998, 20:00 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00559" HREF="msg00559.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Wed 13 May 1998, 21:46 GMT
</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>