1999Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: RE: [MUD&#45;Dev] Sockets -->
<!--X-From-R13: Quevf Uenl <ptNnzv&#45;pt.UenlEntr.Sqzbagba.OP.QO> -->
<!--X-Date: Sun, 9 May 1999 04:23:36 &#45;0700 -->
<!--X-Message-Id: 199905091643.KAA02372@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, RE: [MUD-Dev] Sockets</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">
</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="msg00183.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00185.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00218.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00192.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00184">Author</A>
&nbsp;|&nbsp;<A HREF="#00184">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00184">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>RE: [MUD-Dev] Sockets</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>: RE: [MUD-Dev] Sockets</LI>
<LI><em>From</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>Date</em>: Sun, 9 May 1999 10:43:34 -0600</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Sender</em>: <A HREF="mailto:mud-dev-admin#kanga,nu">mud-dev-admin#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>
[Petri Virkkula:]

&gt; 	I prefer the commands per a second performance measurement,
&gt; 	because that number tells more directly how many players can
&gt; 	be supported by a system.

I would tend to agree. My belief is that your example numbers are weighted
the wrong way, however. I could see it possible for a lightly loaded
multi-threaded system to respond to a single request faster than a
single-threaded system, but that the single-threaded system, having less
overhead, could respond to more requests per second.

&gt; Chris&gt; to say "multi-processor machines"? One could perhaps imagine how a good
&gt; Chris&gt; threaded implementation of something could perform better a poor
&gt; Chris&gt; non-threaded implementation, but I don't think that's what you mean.
&gt;
&gt; 	Actually there aren't many "single-procesor" machines in the
&gt; 	market today (neither so many SMP machines however). Many
&gt; 	(most?) disks for example have their own processors, thus a
&gt; 	PC could be said to be a "multi-processor" machine. However
&gt; 	the term "multi-processor" usually refers to SMP.

I was of course referring to the usual definition of "multi-processor"
as a single computer having multiple normal processors used for doing
whatever user work is thrown at them. Typically SMP (Symmetric Multi-
Processors).

I should perhaps expand on what I'm getting at here. Everyone should agree
that the use of threads on a given system introduces more overhead to
that system because of the need for thread switching, if nothing else.
However, the design of some operating system interfaces may be such that
maximum performance can only be obtained by using multiple threads.
Earlier discussions of the cost of large select or poll calls is an
example of some overheads that may be reduced by having multiple outstanding
calls.

The WIN32 interface in particular is one which essentially forces the
programmer to use multiple threads. Consider the "asynchronous I/O"
features available. You can use their completion routines stuff, but they
aren't really asynchronous because they are only triggered when some
I/O related system call completes (e.g. a poll). You can use their
interface which sends a message on call completion, but for that you
have to have an active window, which is something a MUD server (or http
server or ftp server, etc.) is not likely to want. I'm guessing that
this silliness (sending messages to a window, rather than to an
arbitrary message port) is a historical thing. Lastly, you can use the
"overlapped I/O" features, where an event handle becomes signalled when
the operation completes. Here, you must have something (i.e. a thread)
that is waiting for a bunch of such handles to be ready. The call used
for that, WaitForMultipleObjects, has a fixed, hard limit of 64 handles
that it can wait on. If you want more than that, you have to either
start polling (ugh!) or have multiple threads, each waiting for groups
of handles. So, I agree, that if you are programming under the WIN32
API, you will get better performance by using threads than if you
didn't, but *that is a result of the nature of the API, rather than any
inherent advantage of threads*.

Threads are a tool which can be used to restructure your program into a
style that can be easier to read. They do so at the expense of a little
extra overhead. This is just like using C++ classes with virtual functions
to similarly restructure your program, at a small expense.

--
Don't design inefficiency in - it'll happen in the implementation.

Chris Gray     cg#ami-cg,GraySage.Edmonton.AB.CA
               <A  HREF="http://www.GraySage.Edmonton.AB.CA/cg/">http://www.GraySage.Edmonton.AB.CA/cg/</A>


_______________________________________________
MUD-Dev maillist  -  MUD-Dev#kanga,nu
<A  HREF="http://www.kanga.nu/lists/listinfo/mud-dev">http://www.kanga.nu/lists/listinfo/mud-dev</A>


</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="00192" HREF="msg00192.html">RE: [MUD-Dev] Sockets</A></strong>
<ul compact><li><em>From:</em> "Jon A. Lambert" &lt;jlsysinc#ix,netcom.com&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00183.html">Re: [MUD-Dev] Custom Server Roll Call?</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00185.html">Re: [MUD-Dev] Custom Server Roll Call?</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00218.html">Re: [MUD-Dev] Sockets</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00192.html">RE: [MUD-Dev] Sockets</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00184"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00184"><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>Re: [MUD-Dev] Sockets</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00244" HREF="msg00244.html">Re: [MUD-Dev] Sockets</A></strong>, 
Ross Nicoll <a href="mailto:rnicoll#lostics,demon.co.uk">rnicoll#lostics,demon.co.uk</a>, Fri 14 May 1999, 08:17 GMT
</LI>
</ul>
<LI><strong><A NAME="00210" HREF="msg00210.html">RE: [MUD-Dev] Sockets</A></strong>, 
Caliban Tiresias Darklock <a href="mailto:caliban#darklock,com">caliban#darklock,com</a>, Wed 12 May 1999, 22:17 GMT
</LI>
<LI><strong><A NAME="00219" HREF="msg00219.html">Re: [MUD-Dev] Sockets</A></strong>, 
Mark Gritter <a href="mailto:mark#erdos,Stanford.EDU">mark#erdos,Stanford.EDU</a>, Wed 12 May 1999, 22:26 GMT
<UL>
<LI><strong><A NAME="00218" HREF="msg00218.html">Re: [MUD-Dev] Sockets</A></strong>, 
Mark Gritter <a href="mailto:mark#erdos,Stanford.EDU">mark#erdos,Stanford.EDU</a>, Wed 12 May 1999, 22:26 GMT
</LI>
</UL>
</LI>
</ul>
</ul>
<LI><strong><A NAME="00184" HREF="msg00184.html">RE: [MUD-Dev] Sockets</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 09 May 1999, 11:23 GMT
<UL>
<LI><strong><A NAME="00192" HREF="msg00192.html">RE: [MUD-Dev] Sockets</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Tue 11 May 1999, 20:10 GMT
<UL>
<LI><strong><A NAME="00223" HREF="msg00223.html">RE: [MUD-Dev] Sockets</A></strong>, 
Caliban Tiresias Darklock <a href="mailto:caliban#darklock,com">caliban#darklock,com</a>, Wed 12 May 1999, 22:27 GMT
<UL>
<LI><strong><A NAME="00247" HREF="msg00247.html">RE: [MUD-Dev] Sockets</A></strong>, 
Nicholas Lee <a href="mailto:N.J.Lee#statslab,cam.ac.uk">N.J.Lee#statslab,cam.ac.uk</a>, Fri 14 May 1999, 08:24 GMT
<UL>
<LI><strong><A NAME="00268" HREF="msg00268.html">RE: [MUD-Dev] Sockets</A></strong>, 
Caliban Tiresias Darklock <a href="mailto:caliban#darklock,com">caliban#darklock,com</a>, Sun 16 May 1999, 07:56 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</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>