[MUD-Dev] [TECH] Server Bottlenecks
Jeff Thompson
mythrndr at mac.com
Thu Sep 25 14:49:23 CEST 2003
On Tuesday, September 23, 2003, at 10:56 PM, Lazarus wrote:
> The thread-per-connection model presents several technical
> challanges.
I just re-read all of the messages of this thread to make sure this
hadn't been mentioned before, but if I did in fact miss it then I
apologize.
One area to look into is coroutines. Coroutines are essentially
multiple cooperative user level threads existing within one "real"
thread. Coroutines work by changing the stack pointer to different
allocated stacks within a thread's virtual memory space and jumping
into code. Since you are not changing "task/thread/process contexts"
(name depends on architecture), you do not incur a task switching
performance penalty. You also have complete control over the size of
the stack for each coroutine so you can balance this against the
virtual memory limitations of your target platform(s). There is of
course still a penalty for changing the stack pointer and jumping
into another code location.
The Portable Coroutines Library (PCL) is a nice implementation of
this concept and includes it's own example threading library. You
can find this library at http://xmailserver.org/libpcl.html This
library is unfortunately GPL, so you may wind up needing to roll
your own.
http://xmailserver.org/rse-pmt.pdf contains a very clear discussion
of writing portable coroutine libraries and allowed me to whip up my
own Mac OS X version in about a half hour.
If you live entirely in the Windows space, then you should be
looking into Fiber's as Microsoft has done a good job of providing
this capability for you already.
Best of luck to all,
Jeff
Jeff Thompson
CTO, CodeTek Studios, Inc.
http://www.codetek.com/
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list