1998Q3/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: lockless system &#45; foolproof? -->
<!--X-From-R13: Xnzrf Ivyfba <wjvyfbaNebpurfgre.ee.pbz> -->
<!--X-Date: Sun, 30 Aug 1998 18:09:17 &#45;0700 -->
<!--X-Message-Id: 98083021000708.12025@d185d1e96 -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: E0zDDxm&#45;0008Mx&#45;00#mail,kanga.nu -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: lockless system - foolproof?</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:jwilson#rochester,rr.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="msg00881.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00883.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00878.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00883.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00882">Author</A>
&nbsp;|&nbsp;<A HREF="#00882">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00882">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: lockless system - foolproof?</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: lockless system - foolproof?</LI>
<LI><em>From</em>: James Wilson &lt;<A HREF="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</A>&gt;</LI>
<LI><em>Date</em>: Sun, 30 Aug 1998 20:36:11 -0400</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></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, 30 Aug 1998, J C Lawrence wrote:
&gt;On Sat, 29 Aug 1998 19:42:17 -0400 
&gt;James Wilson&lt;jwilson#rochester,rr.com&gt; wrote:
&gt;
&gt;&gt; In order to avoid the problems inherent in thread synchronization,
&gt;&gt; (I think) JC has suggested a lockless system based on (what I call)
&gt;&gt; per-object "cache invalidation", that is, writes to objects a thread
&gt;&gt; is examining invalidate that thread's cache and hook a restart of
&gt;&gt; the event being processed.  This is fine for single-object locking,
&gt;&gt; but (as far as I understand it) does not address the case where an
&gt;&gt; event must deal with multiple objects atomically without those
&gt;&gt; objects mutating under it. 
&gt;
&gt;No, you are missing a key point:  The only time that an "invalidation"
&gt;(as you term it) occurs is when an object successfully C&amp;C's.  ie For
&gt;any event to be rescheduled there must have been a prior event which
&gt;successfully compleated (this ignores the minor question of internal
&gt;event failures and time-outs).

*shrug* I guess I wasn't clear enough. What you describe is exactly what I
meant.

[snip]

&gt;&gt; one solution could be: C doesn't save its change to A to the
&gt;&gt; database until it has also changed B. When it does save changes, it
&gt;&gt; will then need an atomic operation to save A and B simultaneously.
&gt;
&gt;Bingo.
&gt;
&gt;&gt; Assuming this solution (please let me know if there are any other
&gt;&gt; solutions), the possibility arises of having to collect a large
&gt;&gt; number of such database commits due to some operation on a complex
&gt;&gt; compound object, where guaranteeing the atomicity of access to
&gt;&gt; subobjects is not sufficient. Then a thread which tries to grab all
&gt;&gt; the objects in question, operate upon them in such a way that the
&gt;&gt; overall constraints are satisfied, and save the changes, would be
&gt;&gt; vulnerable to frequent, possibly endless restarts as one or another
&gt;&gt; of the many objects it is trying to keep coherent is changed.
&gt;
&gt;True.  

[example snipped]

&gt;The easiest and perhaps the simplest way of attacking this is thru
&gt;approaching the level of parallelism in your execution model.  Again,
&gt;taking the pessimal case, if the execution model degrades until only
&gt;one event is executing at a time, then X is guaranteed to successfully
&gt;C&amp;C when its turn comes as there is no competition.
&gt;
&gt;This is the approach I take.  Events enter the Executor with a
&gt;"priority" value.  As events fail C&amp;C they accumulate priority.  The
&gt;executor's execution model then adapts dynamically per the highest
&gt;priority event on its list.  At one end its the normal unrestrained
&gt;competition between events, and t the other it degrades to
&gt;single-tasking with everal stages in between.

Are your events guaranteed to complete in bounded time? You mentioned that you
are designing with user scripting in mind. If one of those contentious events 
ends up getting a monopoly on cpu time, *and* it's of long/indefinite duration
(which would seem to correlate nicely with the propensity for contentiousness),
everything would freeze waiting for it.

While some might say it seems a bad idea to allow users to write long-running
functions, a scripting system would seem to me to be most useful to builders
wanting to add new functionality to the world without having to muck about in
the source code. In this case, putting bounds on running time would be a serious
constraint on builder creativity. Ideally, bounding runtimes should be a
matter of policy rather than forced by the implementation. 

James


</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="00883" HREF="msg00883.html">[MUD-Dev] Re: lockless system - foolproof?</A></strong>
<ul compact><li><em>From:</em> J C Lawrence &lt;claw#kanga,nu&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00878" HREF="msg00878.html">[MUD-Dev] Re: lockless system - foolproof?</A></STRONG>
<UL><LI><EM>From:</EM> J C Lawrence &lt;claw#kanga,nu&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00881.html">[MUD-Dev] Admin: OS wars and avocacy are off-topic</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00883.html">[MUD-Dev] Re: lockless system - foolproof?</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00878.html">[MUD-Dev] Re: lockless system - foolproof?</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00883.html">[MUD-Dev] Re: lockless system - foolproof?</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00882"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00882"><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: Modular MUD</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00893" HREF="msg00893.html">[MUD-Dev] Re: Modular MUD</A></strong>, 
Bruce Mitchener, Jr. <a href="mailto:ubmitche#mcs,drexel.edu">ubmitche#mcs,drexel.edu</a>, Mon 31 Aug 1998, 20:43 GMT
</LI>
<LI><strong><A NAME="00898" HREF="msg00898.html">[MUD-Dev] Re: Modular MUD</A></strong>, 
John Bertoglio <a href="mailto:alexb#internetcds,com">alexb#internetcds,com</a>, Tue 01 Sep 1998, 06:43 GMT
</LI>
</ul>
</LI>
<LI><strong><A NAME="00870" HREF="msg00870.html">[MUD-Dev] lockless system - foolproof?</A></strong>, 
James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Sun 30 Aug 1998, 05:34 GMT
<UL>
<LI><strong><A NAME="00878" HREF="msg00878.html">[MUD-Dev] Re: lockless system - foolproof?</A></strong>, 
J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Sun 30 Aug 1998, 20:20 GMT
<UL>
<LI><strong><A NAME="00882" HREF="msg00882.html">[MUD-Dev] Re: lockless system - foolproof?</A></strong>, 
James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Mon 31 Aug 1998, 01:09 GMT
<UL>
<LI><strong><A NAME="00883" HREF="msg00883.html">[MUD-Dev] Re: lockless system - foolproof?</A></strong>, 
J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Mon 31 Aug 1998, 05:49 GMT
<UL>
<LI><strong><A NAME="00886" HREF="msg00886.html">[MUD-Dev] Re: lockless system - foolproof?</A></strong>, 
T. Alexander Popiel <a href="mailto:popiel#snugharbor,com">popiel#snugharbor,com</a>, Mon 31 Aug 1998, 14:42 GMT
<UL>
<LI><strong><A NAME="00899" HREF="msg00899.html">[MUD-Dev] Re: lockless system - foolproof?</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Tue 01 Sep 1998, 17:50 GMT
<UL>
<LI><strong><A NAME="00903" HREF="msg00903.html">[MUD-Dev] Re: lockless system - foolproof?</A></strong>, 
T. Alexander Popiel <a href="mailto:popiel#snugharbor,com">popiel#snugharbor,com</a>, Wed 02 Sep 1998, 04:57 GMT
</LI>
</UL>
</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>