Threads and Sockets (Was Ho hum)

S001GMU at nova.wright.edu S001GMU at nova.wright.edu
Mon Apr 14 14:19:40 New Zealand Standard Time 1997


just a thought that someone got stuck in my head.

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).

As I sed, just a thought.  ;)

-Greg



More information about the MUD-Dev mailing list