msg00870.html
1998Q3/msg00870.html · 8.0 KB
From the archive 1998Q3.zip
Download the archive « Back to the archive contents
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD-Dev] lockless system - foolproof? -->
<!--X-From-R13: Xnzrf Ivyfba <wjvyfbaNebpurfgre.ee.pbz> -->
<!--X-Date: Sat, 29 Aug 1998 22:34:07 -0700 -->
<!--X-Message-Id: 98083001250102.12025@d185d1e96 -->
<!--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] 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>
[ <a href="../">Other Periods</a>
| <a href="../../">Other mailing lists</a>
| <a href="/search.php3">Search</a>
]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->
Date:
[ <a href="msg00869.html">Previous</a>
| <a href="msg00871.html">Next</a>
]
Thread:
[ <a href="msg00898.html">Previous</a>
| <a href="msg00878.html">Next</a>
]
Index:
[ <A HREF="author.html#00870">Author</A>
| <A HREF="#00870">Date</A>
| <A HREF="thread.html#00870">Thread</A>
]
<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] 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] lockless system - foolproof?</LI>
<LI><em>From</em>: James Wilson <<A HREF="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</A>></LI>
<LI><em>Date</em>: Sat, 29 Aug 1998 19:42:17 -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>
In order to avoid the problems inherent in thread synchronization, (I
think) JC has suggested a lockless system based on (what I call) per-object
"cache invalidation", that is, writes to objects a thread is examining
invalidate that thread's cache and hook a restart of the event being processed.
This is fine for single-object locking, but (as far as I understand it) does
not address the case where an event must deal with multiple objects atomically
without those objects mutating under it. In this case, the compound object
would need to be locked, and all its components locked, in order to prevent
concurrent accesses from constantly (and perhaps indefinitely) restarting the
event that needs the whole object at once. Please correct me if I'm wrong...
The simple case is this: we have two objects, A and B, containing reference
fields. The programmer would like to guarantee that, if A points to B, B will
point back to A, and vice versa; that is, there will always be a cycle between
them. A and B could be nodes in a doubly linked list, for instance, where
node->previous->next == node || 0 == node->previous
and
node->next->previous == node || 0 == node->next
should always be true. If thread C grabs A and breaks its link to B, and if
thread D grabs B before C gets a chance to break its link to A, how can be
ensure that the constraint is not broken? one solution could be: C doesn't save
its change to A to the database until it has also changed B. When it does save
changes, it will then need an atomic operation to save A and B simultaneously.
Assuming this solution (please let me know if there are any other solutions),
the possibility arises of having to collect a large number of such database
commits due to some operation on a complex compound object, where guaranteeing
the atomicity of access to subobjects is not sufficient. Then a thread which
tries to grab all the objects in question, operate upon them in such a way that
the overall constraints are satisfied, and save the changes, would be
vulnerable to frequent, possibly endless restarts as one or another of the many
objects it is trying to keep coherent is changed.
Someone suggested that after several cache invalidations the thread might try a
different tack, explicitly locking the structure it is manipulating and all the
objects underneath it. This brings us right back to what we wanted to avoid,
locking and the concomitant possibility of deadlock.
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="00878" HREF="msg00878.html">[MUD-Dev] Re: lockless system - foolproof?</A></strong>
<ul compact><li><em>From:</em> J C Lawrence <claw#kanga,nu></li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00869.html">[MUD-Dev] Re: Modular MUD</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00871.html">[MUD-Dev] Re: Modular MUD</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00898.html">[MUD-Dev] Re: Modular MUD</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00878.html">[MUD-Dev] Re: lockless system - foolproof?</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00870"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00870"><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: Encryption of protocols, compression and lag...</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00904" HREF="msg00904.html">[MUD-Dev] Re: Encryption of protocols, compression and lag...</A></strong>,
Ola Fosheim Grøstad <a href="mailto:olag#ifi,uio.no">olag#ifi,uio.no</a>, Wed 02 Sep 1998, 09:38 GMT
<UL>
<LI><strong><A NAME="00912" HREF="msg00912.html">[MUD-Dev] Re: Encryption of protocols, compression and lag...</A></strong>,
Adam J. Thornton <a href="mailto:adam#phoenix,Princeton.EDU">adam#phoenix,Princeton.EDU</a>, Wed 02 Sep 1998, 16:28 GMT
</LI>
</UL>
</LI>
</ul>
</ul>
<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
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>
</ul>
<hr>
<center>
[ <a href="../">Other Periods</a>
| <a href="../../">Other mailing lists</a>
| <a href="/search.php3">Search</a>
]
</center>
<hr>
</body>
</html>