1998Q3/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine -->
<!--X-From-R13: f001tzhNabin.jevtug.rqh -->
<!--X-Date: Tue, 21 Jul 1998 06:29:22 &#45;0700 -->
<!--X-Message-Id: Pine.PMDF.3.95.980721090453.541211270A&#45;100000#nova,wright.edu -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199807210242.TAA12409#goose,prod.itd.earthlink.net -->
<!--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:s001gmu#nova,wright.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="msg00275.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00277.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00275.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00671.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00276">Author</A>
&nbsp;|&nbsp;<A HREF="#00276">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00276">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>: MUD Dev &lt;<A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A>&gt;</LI>
<LI><em>Subject</em>: [MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</LI>
<LI><em>From</em>: <A HREF="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</A></LI>
<LI><em>Date</em>: Tue, 21 Jul 1998 09:27:39 -0400 (EDT)</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 Mon, 20 Jul 1998, Todd Lair wrote:

&gt; On Sat, 18 Jul 1998 10:55:38 -0600, Chris Gray wrote:
&gt; 
&gt; [Chris Gray:]
&gt; 
&gt; &gt;As in Oliver's previous reply, there shouldn't be a need to have an
&gt; &gt;explictly polled "event" associated with checking the socket for a
&gt; &gt;client (or the main connection socket). If, as he mentions, you wish
&gt; &gt;to slow the clients down, you can do that by not processing the
&gt; &gt;received client input until it is time to do so. If that isn't why
&gt; &gt;you are doing an event per socket, then a change could be even
&gt; &gt;easier - just get rid of those events. Then, put all sockets on the
&gt; &gt;select, and process user input whenever it arrives. The only minor
&gt; &gt;flaw with that is that you could start to get behind on processing
&gt; &gt;real queued events, if you are continually getting input from users.
&gt; &gt;In that case, your server is too busy, and you need to think about
&gt; &gt;ways of pacing things.
&gt; 
&gt; The motivation for my associating an event with each socket was to
&gt; try to eliminate the select call.  Understand, I'm still learning
&gt; here, and I may have gone down a path that may prove more costly. 
&gt; I'm not trying to slow down clients at all, although I see how I've
&gt; done this.  In fact, I had to make my tick time size very minute in
&gt; order to have responsive input times.  Much smaller than I would have
&gt; prefered.  Although, while the event queues are hardly at full force
&gt; yet, the CPU usage of this seems small.

If each socket has an explicitly associated event, (IE: when the event
goes off, it knows what socket to look at, and it passes that info on to
the next generated event), why not just use a non-blocking read/write
call?  If I understand the way select() works, it essentially does that
for all the FD's in the FD_SETs.  

something like:

handle_socket_check_event (int fd)
{
  if (read(fd,...) != 0)
    handle_input(...);

  if (pending_output(fd))
    if ( (c = write(fd, ...)) != 0)  // I believe write returns the number
                                     // of bytes written.
      update_pending_output_buffer(fd, c);

  if (check for exceptions here)
    // do socket exception code here

  schedule_event('handle_socket_check_event', fd, time);
}

This, of course, assumes you have set the I/O up as non-blocking ahead of
time.  If you are unsure how to do that in *nix, I can send a block of
sample code.

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

Yeah... it seems awfully ugly.  I've spent many an hour pondering a
gracefull way around that.

[poll() vs select()] 

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

I have no idea.  My first guess is that it would be part of the libc, and
not part of the kernel, but my knowledge of where the line lies betwixt
libc and the kernel is admitedly lacking.  I haven't looked for it on my
2.0.30, but I don't recall seeing it mentioned in any of the patch
notices.

Have you tried to just compile a program with a call to poll() in it?  :)
Also, you may try grepping the source and lib paths for it.  It may be
sans man page, but actually exist.  *shrug*

-Greg



</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00275" HREF="msg00275.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></STRONG>
<UL><LI><EM>From:</EM> "Todd Lair" &lt;tlair#mailzone,com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00275.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00277.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00275.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00671.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00276"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00276"><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>
<ul compact>
<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>
</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>
<LI><strong><A NAME="00693" HREF="msg00693.html">[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</A></strong>, 
Gevan <a href="mailto:shanos#es,co.nz">shanos#es,co.nz</a>, Wed 12 Aug 1998, 18:57 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>