[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

24034: Re: [MUD-Dev] Multithreaded sockets

[Full Header] [Plain Text]
From: "Sean Kelly" <sean@ffwd.cx>
Newsgroups: nu.kanga.list.mud-dev
Date: Mon, 3 Jun 2002 07:32:23 -0700
References: [1] [2] [3] <-newest
Organization: Kanga.Nu
From: "Draymoor a Vin il'Rogina" <draymoor@cloud9.net>

> I was looking through the archives and came across a post in which
> it was suggested that a thread for game logic and a thread for
> descriptor input would be ideal, on a dual processor
> machine. Right now, I have a thread for each descriptor to recieve
> input from blocking sockets, a thread to accept new descriptors
> and parse input, and a thread for the game logic. I'm running on a
> single processor machine, though hopefully soon it'll be a double
> processor.  Is having this many threads a bad idea?

If you are planning to scale very far, particular on a Windows
machine, then yes.  There is cost for context switching, and with a
high connection count your CPU may be spending nearly as much time
switching between threads as it spends in the threads themselves.
This isn't a very efficient use of resources.  Problem is, the best
way to overcome this is really platform-dependent.  In Windows, it's
IOCP.  I believe that Linux also has a similar kernel-level
signaling architecture now, too.  Barring that, there's always
select and nonblocking sockets.

Sean

_______________________________________________
MUD-Dev mailing list
MUD-Dev@kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev