Re: Threads?

From: George (greerga@CIRCLEMUD.ORG)
Date: 01/27/98

On Tue, 27 Jan 1998, Franco Gasperino wrote:

>> Actually you could get around this by using a mutex lock on the global
>> variables.  Just put a lock infront of all of the critical sections, and
>> release the lock when it is safe for those global variables to be
>> overwritten.
>   Problem with that is, that these global buffers are used in nearly
>every function within the stock game, and therefore calling mutex or
>critical section locks wouldnt give the game much more performance, if

I assumed he meant descriptor_list, character_list, and the like, although
what you say is true.

>any. Optimally, if not redesigned in an object-oriented structure, you
>could avoid global buffer switching and locking by making a similar buffer
>for each descriptor, and run a thread for each. Then use local or minimal
>global buffers for mobs and the like.

Ugh, 8k (default) buffers for every player?

>> As far as threads go, probably the best candidate (sp?) for spawning of
>> threads would be the ident lookup or dns name resolving.  Any other
>> threads probably won't help much (ie. hard to document the
>> benefits) unless you are running on a multi-processor type system.
>   Maybe currently using the network I/O threading that George has developed,
>plus game-booting threads (ive seen major areas here where it could be
>improved), and possibily some disk I/O (still requires a fair amount of
>sync'ing tho).

I wouldn't call it much of a development, I just noticed that nothing below
game_loop uses buf besides the character processing.  Thusly, you can have
a network thread take care of matters without the global buffers while the
character processing thread does use them.

>> Basically, with threads you just have to be careful that variables that
>> can be used by more than one thread don't get stomped on. And mutex locks
>> are the solution for that.
>   Agreed.

Yes, but with buffers it would create too much of a performance hit.  There
needs to be a new system.  It will wait til at least 3.2, 4.0, or whatever
else we call the new version of CircleMUD after 3.1 is finally out.

George Greer  -   | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST