1997Q3/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Multi&#45;threaded programming under Linux -->
<!--X-From-R13: Qlaor eh Fnera <plaorNynhery.npgyno.hgrknf.rqh> -->
<!--X-Date: from stimpy.globecomm.net [207.51.48.4] by in4.ibm.net id 869673100.42444&#45;1 Wed Jul 23 15:51:40 1997 CUT -->
<!--X-Message-Id: 199707231551.KAA25480#laurel,actlab.utexas.edu -->
<!--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] Multi-threaded programming under Linux</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:cynbe#laurel,actlab.utexas.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="msg00226.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00228.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00258.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00229.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00227">Author</A>
&nbsp;|&nbsp;<A HREF="#00227">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00227">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Multi-threaded programming under Linux</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>: [MUD-Dev] Multi-threaded programming under Linux</LI>
<LI><em>From</em>: Cynbe ru Taren &lt;<A HREF="mailto:cynbe#laurel,actlab.utexas.edu">cynbe#laurel,actlab.utexas.edu</A>&gt;</LI>
<LI><em>Date</em>: Wed, 23 Jul 1997 10:51:39 -0500</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>

[cg#ami-cg,GraySage.Edmonton.AB.CA (Chris Gray):]

| Yep!
| 
| The big problem with not using OS-level threads is that you only get
| to have one system call active at a time in your whole program. With
| OS-level threads, you can have several threads actively doing system
| calls. That lets you have threads updating your on-disk database or
| something, at the same time as other threads are doing socket calls.

Again, I don't want to suggest OS-level threads aren't a reasonable
design choice:  They are.  But, as usual, there's more than one way
to skin a cat.

select() on nonblocking sockets lets one effectively multiplex lots of
I/O: On a uniprocessor, OS threads really aren't going to improve
stuff on the net I/O front.

Blocking an entire multi-user server for disk I/O is certainly nasty:
If it gets to be a significant problem, I've been intending to switch
to a dual-process implementation, where one runs in-memory stuff and
the other handles all the "slow" system calls, mostly disk I/O: They
can communicate via a pipe or shared memory segment.  This is creeping
up on OS multithreading but still quite portable: Pipes and shared
memory are pretty stable and standard at this point, especially vs
threads.

Having the host OS automatically spreading threads across multiple CPUs 
is definitely nice if you've got 'em!  (Just building my first dual-cpu
box, to get my feet wet.)

On the other hand, my design is anyhow intended to support
WAN-distributed worlds, so for me, running enough local servers to
keep multiple CPUs busy isn't out of the question, and yields the
benefit of segmenting the state into managable-sized hunks (which
isn't a bad thing) and of giving a degree of graceful degradation: If
one server crashes, a subset of the world state goes unresponsive,
but users on the other servers can chug right along,  whereas with
the multithreads in a single server, you tend to lose the whole
shebang when something goes wrong.  Interprocess firewalls were
introduced for a reason, dispensing with them isn't a pure and
simple win. :)

 Cynbe

</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="00229" HREF="msg00229.html">Re: [MUD-Dev] Multi-threaded programming under Linux</A></strong>
<ul compact><li><em>From:</em> Orion Henry &lt;ohenry#sdcc10,ucsd.edu&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="msg00226.html">Re: [MUD-Dev]  Multi-threaded programming under Linux</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00228.html">Re: [MUD-Dev]  C&amp;C and Event Rescheduling</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00258.html">Re: [MUD-Dev]  Motivating people</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00229.html">Re: [MUD-Dev] Multi-threaded programming under Linux</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00227"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00227"><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="00238" HREF="msg00238.html">Re: [MUD-Dev]	Motivating people</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Fri 25 Jul 1997, 13:04 GMT
<UL>
<LI><strong><A NAME="00259" HREF="msg00259.html">Re: [MUD-Dev] Motivating people</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Tue 29 Jul 1997, 12:17 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00234" HREF="msg00234.html">Motivating people</A></strong>, 
Greg Munt <a href="mailto:greg#uni-corn,demon.co.uk">greg#uni-corn,demon.co.uk</a>, Fri 25 Jul 1997, 01:39 GMT
<UL>
<LI><strong><A NAME="00258" HREF="msg00258.html">Re: [MUD-Dev]  Motivating people</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Tue 29 Jul 1997, 10:09 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00227" HREF="msg00227.html">[MUD-Dev] Multi-threaded programming under Linux</A></strong>, 
Cynbe ru Taren <a href="mailto:cynbe#laurel,actlab.utexas.edu">cynbe#laurel,actlab.utexas.edu</a>, Wed 23 Jul 1997, 22:51 GMT
<UL>
<LI><strong><A NAME="00229" HREF="msg00229.html">Re: [MUD-Dev] Multi-threaded programming under Linux</A></strong>, 
Orion Henry <a href="mailto:ohenry#sdcc10,ucsd.edu">ohenry#sdcc10,ucsd.edu</a>, Thu 24 Jul 1997, 01:49 GMT
<UL>
<LI><strong><A NAME="00233" HREF="msg00233.html">Re: [MUD-Dev] OT: Multi-threaded programming under Linux</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Thu 24 Jul 1997, 12:26 GMT
</LI>
<LI><strong><A NAME="00241" HREF="msg00241.html">Re: [MUD-Dev] Multi-threaded programming under Linux</A></strong>, 
Michael Hohensee <a href="mailto:michael#mainstream,net">michael#mainstream,net</a>, Fri 25 Jul 1997, 22:45 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
<LI><strong><A NAME="00224" HREF="msg00224.html">Re: [MUD-Dev]	Multi-threaded programming under Linux</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Wed 23 Jul 1997, 13:05 GMT
</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>