1997Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: Threads and Sockets (Was Ho hum) -->
<!--X-From-R13: ptNnzv&#45;pt.UenlEntr.Sqzbagba.OP.QO (Quevf Uenl) -->
<!--X-Date: from tacitus.globecomm.net [207.51.48.7] by mx01.ny.us.ibm.net id 861570592.75300&#45;1 Sun Apr 20 21:09:52 1997 -->
<!--X-Message-Id: 9704202012.7xtz@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: Threads and Sockets (Was Ho hum)</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="msg00166.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00171.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00143.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00135.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00168">Author</A>
&nbsp;|&nbsp;<A HREF="#00168">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00168">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: Threads and Sockets (Was Ho hum)</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: Threads and Sockets (Was Ho hum)</LI>
<LI><em>From</em>: <A HREF="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</A> (Chris Gray)</LI>
<LI><em>Date</em>: Sun, 20 Apr 97 13:12:52 MST</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
[Greg:]
:I know threads are less expensive than full process switching, but isn't using
:threads of the main program for handling I/O kinda dangerous?	If the sockets
:or any I/O bombs, down comes the whole program, or if the program goes down,
:everyone gets dropped from the game.  I've been leaning towards a
:multi-processesing, multi-threaded environment where *most* of the mechanics
:are grouped into one process that is threaded and all the file I/O and socket
:Handling is done with other processes (possibly also threaded).  That way, if
:one process crashes the rest can keep plugging along or (in the case of the
:game crashing and the socket process still running) tell the players that the
:mud is experienceing technical difficulties (after some timeout period
:expires).  I use the message queue system to communicate among the processes,
:mainly because it lends itself nicely to an event driven system and packaging
:commands and info into discrete units (which I prefer to deal with).

Threads can be fairly cheap, since they share the virtual address space,
and so can communicate quickly. With separate processes, however, it
generally takes a system call or two to safely communicate between them.
You *can* use things like spin-locks in shared memory regions/segments,
but you have to be careful, and be prepared for the occasional very
inappropriate time slice from the OS.

System calls are the bane of the parallel processing stuff we do at work,
as are process switches. We stand on one leg and wiggle our ears in order
to reduce the numbers of both :-)

--
Chris Gray   cg#ami-cg,GraySage.Edmonton.AB.CA

</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="msg00166.html">I'm back</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00171.html">Re: Your Message To mud-dev</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00143.html">Re: Threads and Sockets (Was Ho hum)</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00135.html">Strings &amp; Memory Usage</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00168"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00168"><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><A NAME="00136" HREF="msg00136.html">Threads and Sockets (Was Ho hum)</A></strong>, 
S001GMU <a href="mailto:S001GMU#nova,wright.edu">S001GMU#nova,wright.edu</a>, Tue 15 Apr 1997, 03:55 GMT
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00139" HREF="msg00139.html">Re: Threads and Sockets (Was Ho hum)</A></strong>, 
Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Tue 15 Apr 1997, 10:09 GMT
</LI>
<LI><strong><A NAME="00140" HREF="msg00140.html">Re: Threads and Sockets (Was Ho hum)</A></strong>, 
S001GMU <a href="mailto:S001GMU#nova,wright.edu">S001GMU#nova,wright.edu</a>, Tue 15 Apr 1997, 20:33 GMT
</LI>
<LI><strong><A NAME="00143" HREF="msg00143.html">Re: Threads and Sockets (Was Ho hum)</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Tue 15 Apr 1997, 23:07 GMT
</LI>
<LI><strong><A NAME="00168" HREF="msg00168.html">Re: Threads and Sockets (Was Ho hum)</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Mon 21 Apr 1997, 04:09 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00135" HREF="msg00135.html">Strings &amp; Memory Usage</A></strong>, 
Greg Munt <a href="mailto:greg#uni-corn,demon.co.uk">greg#uni-corn,demon.co.uk</a>, Tue 15 Apr 1997, 03:13 GMT
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00138" HREF="msg00138.html">Re: Strings &amp; Memory Usage</A></strong>, 
Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Tue 15 Apr 1997, 09:59 GMT
</LI>
<LI><strong><A NAME="00141" HREF="msg00141.html">Re: Strings &amp; Memory Usage</A></strong>, 
Shawn Halpenny <a href="mailto:rsh#dos,nortel.com">rsh#dos,nortel.com</a>, Tue 15 Apr 1997, 22:28 GMT
</LI>
<LI><strong><A NAME="00142" HREF="msg00142.html">Re: Strings &amp; Memory Usage</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Tue 15 Apr 1997, 22:59 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>