[MUD-Dev] Sockets
Jon A. Lambert
jlsysinc at ix.netcom.com
Mon May 3 22:46:59 CEST 1999
On 22 Apr 99,, Jo Dillon wrote:
> Quzah [softhome] (quzah at softhome.net) spake thusly:
> > What is the main difference between and benifit of using:
> >
> > (1) asynchronous notification
> > <versus>
> > (2) versus non-blocking
> > <versus>
> > (3) using select
>
> Actually, there is a (4) - blocking i/o within threads. This is good
> for very complex interactions with a client (since you don't need a state
> machine or anything icky like that) but has portability and scalability
> problems (worse than select()? I'd be interested to know, at least as
> regards Linux...) It's also quite hard to write a reliable threaded
> program since problems can be non-reproducible.
>
There is also (5) Overlapped I/O which is only available on NT 4.0 or higher
and a bit difficult to program. It's conceptually similar to readv() and
writev() on BSD. Asynchronous sockets are available also on all windows
platforms, and are the easiest to program and most code readable. But they
have a bit higher overhead because they must use windowed messaging. They are
the only alternative to non-blocking on Win16 but I don't suppose anyone's
interested in that. ;)
Option 4 that Jo gave above is highly preferred over non-blocking sockets on
Win32 servers. They really "should" be the preferable performance choice on
Unix/BSD systems also. I don't know why more muds aren't using them. I know
it's pretty much standard fare for the better FTP and HTTP servers.
Ranking the options from best to worst from a performance standpoint
(Note- Win32 only):
1. Overlapped I/O
2. Blocking - w/threads
3. Asynchronous sockets
4. Non-blocking
5. Blocking - w/o threads
And ranking them by easiest to program and understand:
1. Blocking - w/o threads
2. Asynchronous
3. Non-blocking
4. Blocking - w/threads
5. Overlapped I/O
FYI ... YMMV. ;)
--
--* Jon A. Lambert - TychoMUD Email:jlsysinc at .ix.netcom.com *--
--* Mud Server Developer's Page <http://pw1.netcom.com/~jlsysinc> *--
--* I am the Dragon of Grindly Grund, but my lunches aren't very much fun, *--
--* For I like my damsels medium rare, And they always come out well done. *--
_______________________________________________
MUD-Dev maillist - MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list