1998Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: atomic functions -->
<!--X-From-R13: "Xba O. Znzoreg" <wyflfvapNvk.argpbz.pbz> -->
<!--X-Date: Sat, 2 May 1998 00:39:39 &#45;0700 -->
<!--X-Message-Id: 199805020738.CAA01505@dfw&#45;ix2.ix.netcom.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199804300159.DAA16625#xs1,simplex.nl -->
<!--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: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="msg00321.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00323.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00406.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00427.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00322">Author</A>
&nbsp;|&nbsp;<A HREF="#00322">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00322">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>: "Jon A. Lambert" &lt;<A HREF="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</A>&gt;</LI>
<LI><em>Date</em>: Sat, 2 May 1998 03:41:43 -5</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 30 Apr 98 at 3:59, Felix A. Croes wrote:
&gt;
&gt; Having recently completed the implementation of the generic parsing
&gt; utility that I posted about earlier, I am now preparing to convert
&gt; my server to the lockless multithreading paradigm put forward on this
&gt; list by J.C. Lawrence.
&gt;
&gt; It has occurred to me that the commit-or-fail idea can be applied to
&gt; parts of threads as well as entire threads, leading to the following
&gt; concept of "atomic functions":
&gt; 
&gt;     An atomic function is a function that succeeds or fails as a
&gt;     whole.  Any runtime error that is not caught within the function
&gt;     will lead to the entire function call, with all its effects
&gt;     and side-effects, being undone.
&gt; 
&gt; Atomic functions would be used to enforce consistency -- just like a
&gt; thread either fails or succeeds without leaving the mud in an
&gt; inconsistent, half-completed state.  Of course, every function called
&gt; at the beginning of a thread is effectively called atomically, so
&gt; code that depends on atomic functions can be replaced by code that
&gt; depends on (atomic) threads.  The advantage of atomic functions
&gt; would be to place the function call within the wider thread
&gt; context, which would be similar to imposing an execution order on
&gt; threads.  Also, calls to atomic functions could be nested.
&gt; 
&gt; Comments?  Is anyone already using this for his own server?
&gt; 

Very interesting.  J.C. has been quite convincing and has opened my 
eyes to many good ideas in this area.  I'm adopting something I've 
dubbed S&amp;S or Spin-Lock and Swizzle.  In essence a multithreaded 
locking system.  But ignoring this implementation detail, the 
language implementation is more relevant here. 

My terminology differs with yours slightly: 

   Transaction == Event == Atomic function 
        ... and is assumed to be == Thread   
   Method call == Function call
   Event Method() ~?~ Atomic {fragment} --&gt; not sure here

And from the posted examples of pseudocode we have: 

Felix:
 foo()
 {
     /* code fragment 1 */

     atomic {
  /* code fragment 2, executed atomically */
     }

     /* code fragment 3 */
 }

Jon:
 foo()
 {
     /* code fragment 1 */
     event bar();  /* bar is sceduled for execution as an atomic 
                      function or independent event.  Execution
                      foo() is not suspended but continues 
                    */
     bar(); /* executes bar() as a normal function bar is part of foo */  
        /* code fragment 3 */
 }
 bar()  
 {
     /* code fragment 3 */
 }

Either foo() or bar() may be events or normal functions. Whether they are 
atomic events scheduled for independent execution is dependent on how 
they are called.  Commits are done on successful event completion.  
Rollbacks are done on event failure. 

I think the difference may lie in that your atomic is
more like:

 foo()
 {
     /* code fragment 1 */
     BEGIN_TRANSACTION{
     /* code fragment 2, executed atomically */
     }
     COMMIT_TRANSACTION
     /* code fragment 3 */
 }

Whilst mine is:

 foo()
 {
     /* code fragment 1 */
     FORK bar()
     /* code fragment 3 */
 }

No? More comments? 

--
--/*\ Jon A. Lambert - TychoMUD     Internet:jlsysinc#ix,netcom.com /*\--
--/*\ Mud Server Developer's Page &lt;<A  HREF="http://www.netcom.com/~jlsysinc">http://www.netcom.com/~jlsysinc</A>&gt; /*\--
--/*\   "Everything that deceives may be said to enchant" - Plato   /*\--

-- 
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="00427" HREF="msg00427.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>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00256" HREF="msg00256.html">[MUD-Dev] atomic functions</A></STRONG>
<UL><LI><EM>From:</EM> "Felix A. Croes" &lt;felix#xs1,simplex.nl&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00321.html">[MUD-Dev] Re: Supporting articles found for UOL play style</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00323.html">[MUD-Dev] Re: PK and my "Mobless MUD" idea</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00406.html">[MUD-Dev] Re: atomic functions</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00427.html">[MUD-Dev] Re: atomic functions</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00322"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00322"><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: regulating player-created objects</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00512" HREF="msg00512.html">[MUD-Dev] Re: regulating player-created objects</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Tue 12 May 1998, 01:25 GMT
</LI>
</ul>
</ul>
</ul>
</LI>
<LI><strong><A NAME="00256" HREF="msg00256.html">[MUD-Dev] atomic functions</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Thu 30 Apr 1998, 02:00 GMT
<UL>
<LI><strong><A NAME="00278" HREF="msg00278.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Thu 30 Apr 1998, 20:19 GMT
<UL>
<LI><strong><A NAME="00406" HREF="msg00406.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>, Tue 05 May 1998, 17:53 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00322" HREF="msg00322.html">[MUD-Dev] Re: atomic functions</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sat 02 May 1998, 07:39 GMT
<UL>
<LI><strong><A NAME="00427" HREF="msg00427.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 06 May 1998, 18:45 GMT
<UL>
<LI><strong><A NAME="00551" HREF="msg00551.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, 19:54 GMT
<UL>
<LI><strong><A NAME="00612" HREF="msg00612.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>, Fri 15 May 1998, 20:30 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
<LI><strong><A NAME="00404" HREF="msg00404.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>, Tue 05 May 1998, 16:53 GMT
</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>