1998Q3/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine -->
<!--X-From-R13: "Fbqq Znve" <gynveNznvymbar.pbz> -->
<!--X-Date: Mon, 20 Jul 1998 19:44:21 &#45;0700 -->
<!--X-Message-Id: 199807210242.TAA12409#goose,prod.itd.earthlink.net -->
<!--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: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Eng</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:tlair#mailzone,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="msg00274.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00276.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00317.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00276.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00275">Author</A>
&nbsp;|&nbsp;<A HREF="#00275">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00275">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: "Chris Gray" &lt;<A HREF="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</A>&gt;</LI>
<LI><em>Subject</em>: [MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</LI>
<LI><em>From</em>: "Todd Lair" &lt;<A HREF="mailto:tlair#mailzone,com">tlair#mailzone,com</A>&gt;</LI>
<LI><em>Date</em>: Mon, 20 Jul 1998 22:45:13 +0000</LI>
<LI><em>Cc</em>: "MUD Dev" &lt;<A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A>&gt;</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 Sat, 18 Jul 1998 10:55:38 -0600, Chris Gray wrote:

[Chris Gray:]

&gt;As in Oliver's previous reply, there shouldn't be a need to have an
&gt;explictly polled "event" associated with checking the socket for a
&gt;client (or the main connection socket). If, as he mentions, you wish
&gt;to slow the clients down, you can do that by not processing the
&gt;received client input until it is time to do so. If that isn't why
&gt;you are doing an event per socket, then a change could be even
&gt;easier - just get rid of those events. Then, put all sockets on the
&gt;select, and process user input whenever it arrives. The only minor
&gt;flaw with that is that you could start to get behind on processing
&gt;real queued events, if you are continually getting input from users.
&gt;In that case, your server is too busy, and you need to think about
&gt;ways of pacing things.

The motivation for my associating an event with each socket was to
try to eliminate the select call.  Understand, I'm still learning
here, and I may have gone down a path that may prove more costly. 
I'm not trying to slow down clients at all, although I see how I've
done this.  In fact, I had to make my tick time size very minute in
order to have responsive input times.  Much smaller than I would have
prefered.  Although, while the event queues are hardly at full force
yet, the CPU usage of this seems small.

Exactly what I was trying to do was eliminate select call altogether.
 Before reading Oliver's post, I realized that it seemed a waste to
first set the bits in the appropriate fd_sets going through the
entire list of connections, calling select, and then going through
the entire list yet again to determine who has what I/O ready.

I had no previous knowledge of the poll call, and I was pretty elated
to hear that it existed.  I went looking on my Linux 2.0.29
installation for any sign of it.  No man pages and nothing I can find
in the headers.

&gt;The structure I use for this is similar to what you have described,
&gt;but just a bit different in details. I don't partition the events
&gt;into specific "ticks". I just have a queue of events, sorted by their
&gt;ripening times. When the server wishes to go idle, it does a single
&gt;select on all sockets, with a timeout equal to that of the soonest-to-
&gt;ripen event. When it returns, any active FD's are handled (reading of
&gt;user input, sending of data that was blocked, etc.), and if it was
&gt;a timeout, I check the current time, and any events scheduled for
&gt;before or at this time are done. I have a limit in the event loop
&gt;so that it won't do too many before going back to the select - that's
&gt;my small way of keeping user input at higher priority than NPC and
&gt;other time-based events.

I've been thinking about this, and I think I'm warming up to it.  I
don't think there is a practical way to associate individual events
with sockets without the poll call, and I think I can adapt this
method to my tick based event machine fairly easily.  I assume you
only set bits on the output fd_set for things that do indeed have
output?

&gt;Understood. I just mentioned the 'poll' call explicitly to make sure
&gt;no confusion did arise. If its available on your system, you may want
&gt;to look at using it instead of 'select', since it can be more
&gt;efficient in a multi-threaded server than 'select' - see the earlier
&gt;notes in MUD-dev, as Oliver pointed out.

Would you, or anyone else, know if it is indeed available on later
versions of Linux?

Todd



</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="00671" HREF="msg00671.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>
<ul compact><li><em>From:</em> J C Lawrence &lt;claw#under,engr.sgi.com&gt;</li></ul>
<li><strong><A NAME="00276" HREF="msg00276.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>
<ul compact><li><em>From:</em> s001gmu#nova,wright.edu</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00274.html">[MUD-Dev] Re: DBMS in MU*'s</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00276.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00317.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00276.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00275"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00275"><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: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00300" HREF="msg00300.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
Joel Kelso <a href="mailto:joel#ee,uwa.edu.au">joel#ee,uwa.edu.au</a>, Wed 22 Jul 1998, 02:21 GMT
<UL>
<LI><strong><A NAME="00305" HREF="msg00305.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
s001gmu <a href="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</a>, Wed 22 Jul 1998, 13:30 GMT
</LI>
<LI><strong><A NAME="00311" HREF="msg00311.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Wed 22 Jul 1998, 17:54 GMT
</LI>
<LI><strong><A NAME="00317" HREF="msg00317.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
Adam Wiggins <a href="mailto:adam#angel,com">adam#angel,com</a>, Wed 22 Jul 1998, 20:43 GMT
</LI>
</UL>
</LI>
</ul>
</ul>
</ul>
</ul>
</ul>
<LI><strong><A NAME="00275" HREF="msg00275.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
Todd Lair <a href="mailto:tlair#mailzone,com">tlair#mailzone,com</a>, Tue 21 Jul 1998, 02:44 GMT
<UL>
<LI><strong><A NAME="00276" HREF="msg00276.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
s001gmu <a href="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</a>, Tue 21 Jul 1998, 13:29 GMT
</LI>
<LI><strong><A NAME="00671" HREF="msg00671.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Tue 11 Aug 1998, 23:39 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00673" HREF="msg00673.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Wed 12 Aug 1998, 03:52 GMT
<UL>
<LI><strong><A NAME="00684" HREF="msg00684.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Wed 12 Aug 1998, 16:44 GMT
</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>