<!-- MHonArc v2.4.4 --> <!--X-Subject: [MUD-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 -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> [ <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="msg00274.html">Previous</a> | <a href="msg00276.html">Next</a> ] Thread: [ <a href="msg00317.html">Previous</a> | <a href="msg00276.html">Next</a> ] Index: [ <A HREF="author.html#00275">Author</A> | <A HREF="#00275">Date</A> | <A HREF="thread.html#00275">Thread</A> ] <!--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" <<A HREF="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</A>></LI> <LI><em>Subject</em>: [MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine</LI> <LI><em>From</em>: "Todd Lair" <<A HREF="mailto:tlair#mailzone,com">tlair#mailzone,com</A>></LI> <LI><em>Date</em>: Mon, 20 Jul 1998 22:45:13 +0000</LI> <LI><em>Cc</em>: "MUD Dev" <<A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A>></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:] >As in Oliver's previous reply, there shouldn't be a need to have an >explictly polled "event" associated with checking the socket for a >client (or the main connection socket). If, as he mentions, you wish >to slow the clients down, you can do that by not processing the >received client input until it is time to do so. If that isn't why >you are doing an event per socket, then a change could be even >easier - just get rid of those events. Then, put all sockets on the >select, and process user input whenever it arrives. The only minor >flaw with that is that you could start to get behind on processing >real queued events, if you are continually getting input from users. >In that case, your server is too busy, and you need to think about >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. >The structure I use for this is similar to what you have described, >but just a bit different in details. I don't partition the events >into specific "ticks". I just have a queue of events, sorted by their >ripening times. When the server wishes to go idle, it does a single >select on all sockets, with a timeout equal to that of the soonest-to- >ripen event. When it returns, any active FD's are handled (reading of >user input, sending of data that was blocked, etc.), and if it was >a timeout, I check the current time, and any events scheduled for >before or at this time are done. I have a limit in the event loop >so that it won't do too many before going back to the select - that's >my small way of keeping user input at higher priority than NPC and >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? >Understood. I just mentioned the 'poll' call explicitly to make sure >no confusion did arise. If its available on your system, you may want >to look at using it instead of 'select', since it can be more >efficient in a multi-threaded server than 'select' - see the earlier >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 <claw#under,engr.sgi.com></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> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>