1997Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Threads, IO handling, and Event Queues -->
<!--X-From-R13: @nguna Kbfcr <lbfcrNunjnvv.rqh> -->
<!--X-Date: from major.globecomm.net [207.51.48.5] by mx01.ca.us.ibm.net id 857614210.39345&#45;1 Thu Mar  6 02:10:10 1997 -->
<!--X-Message-Id: Pine.GSO.3.93.970305155639.7594A&#45;100000@uhunix2 -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Threads, IO handling, and Event Queues</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:yospe#hawaii,edu">
</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="msg00054.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00066.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00135.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00066.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00065">Author</A>
&nbsp;|&nbsp;<A HREF="#00065">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00065">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Threads, IO handling, and Event Queues</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: Mud Design Mailing List &lt;<A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A>&gt;</LI>
<LI><em>Subject</em>: Threads, IO handling, and Event Queues</LI>
<LI><em>From</em>: Nathan Yospe &lt;<A HREF="mailto:yospe#hawaii,edu">yospe#hawaii,edu</A>&gt;</LI>
<LI><em>Date</em>: Wed, 5 Mar 1997 16:10:00 -1000</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>

OK, I'm gonna throw in a new topic here. This was actually started rather
innocently, in, of all places, r.g.m.diku.

The thread there is something like Event Driven vs. Loop Driven. Sadly,
its location has kept it rather limp.

The discussion subject is: What is a good scheme for multithreading an
action oriented MUD?

My scheme, as posted there, follows:

Thread the mud at the rooms. Also thread the connections. The system is as
follows:

p - read socket   l - update local clock   a - update clock  g - update clock
l - parse input   o - parse event queus    r - update state  l - synchronize
a - buffer game   c - kill dead events     e - send locates  o   area clocks
y      commands   a - run current events   a    new objects  b   (optional)
e - run nongame   t - update local objects s                 a - update global
r      commands   i - get new events from                    l   states
  - read outbuf   o      local objects                       s - add players
  - send socket   n - queue local events    

The four sets of threads work together, but not on synchronous clocks. The
global thread buffers events for the areas, which buffer events for the
rooms. Rooms can (and some will, deliberately) ignore some events... I
have even created rooms that deliberately don't update their clocks every
other cycle through, thus making age factors half normal in these
places... but the general system is quite fluid. The players' commands
are all buffered in their characters, waiting for the location's clock to
update and run them into the local event queus. A character that leaves a 
location takes along the command buffer... some commands may be lost, if
they pertained to local objects. Kill goblin; kick goblin; flee north;
rest; results in, if the flee precedes the kick, the character fleeing
and resting, forgetting all about kicking the goblin. As it should be.
(Actually, "flee" kills the entire combat queue, but that is beside the
point.)

In any case, I would be interested to see how the rest of you implemented
event queues, multithreading, etc...

   __    _   __  _   _   ,  ,  , ,  
  /_  / / ) /_  /_) / ) /| /| / /\            First Light of a Nova Dawn
 /   / / \ /_  /_) / \ /-|/ |/ /_/            Final Night of a World Gone
Nathan F. Yospe - University of Hawaii Dept of Physics - yospe#hawaii,edu


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00054.html">Re: Just a bit of musing</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00066.html">Re: Threads, IO handling, and Event Queues</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00135.html">Re: mud grammar (was Re: Just a bit of musing)</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00066.html">Re: Threads, IO handling, and Event Queues</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00065"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00065"><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 grammar (was Re: Just a bit of musing)</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00112" HREF="msg00112.html">mud grammar (was Re: Just a bit of musing)</A></strong>, 
claw <a href="mailto:claw#null,net">claw#null,net</a>, Sat 15 Mar 1997, 07:29 GMT
</LI>
<LI><strong><A NAME="00121" HREF="msg00121.html">Re: mud grammar (was Re: Just a bit of musing)</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 16 Mar 1997, 04:15 GMT
</LI>
<LI><strong><A NAME="00133" HREF="msg00133.html">Re: mud grammar (was Re: Just a bit of musing)</A></strong>, 
claw <a href="mailto:claw#null,net">claw#null,net</a>, Tue 18 Mar 1997, 02:30 GMT
</LI>
<LI><strong><A NAME="00135" HREF="msg00135.html">Re: mud grammar (was Re: Just a bit of musing)</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Tue 18 Mar 1997, 23:50 GMT
</LI>
</ul>
</LI>
<LI><strong><A NAME="00065" HREF="msg00065.html">Threads, IO handling, and Event Queues</A></strong>, 
Nathan Yospe <a href="mailto:yospe#hawaii,edu">yospe#hawaii,edu</a>, Thu 06 Mar 1997, 10:10 GMT
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00066" HREF="msg00066.html">Re: Threads, IO handling, and Event Queues</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 06 Mar 1997, 23:49 GMT
</LI>
<LI><strong><A NAME="00067" HREF="msg00067.html">Re: Threads, IO handling, and Event Queues</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Sat 08 Mar 1997, 11:38 GMT
</LI>
<LI><strong><A NAME="00074" HREF="msg00074.html">Re: Threads, IO handling, and Event Queues</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Sat 08 Mar 1997, 11:54 GMT
</LI>
<LI><strong><A NAME="00075" HREF="msg00075.html">Re: Threads, IO handling, and Event Queues</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Sat 08 Mar 1997, 13:44 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>