Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: To Vasik - What is the progress of MP Rybka ?

Author: Dann Corbit

Date: 16:08:31 01/19/06

Go up one level in this thread


On January 19, 2006 at 16:45:37, Tord Romstad wrote:

>On January 19, 2006 at 15:02:26, Dann Corbit wrote:
>
>>On January 19, 2006 at 03:48:34, Tord Romstad wrote:
>>
>>>Why?  Wouldn't a chess engine using multiple processes and
>>>shared memory be just as fast as a similar program with
>>>multiple threads on a computer with several CPUs (or CPUs
>>>with multiple cores)?  I thought the engine using processes
>>>would just consume a bit more memory, and not have any
>>>significant disadvantages apart from that.
>>>
>>>I'm not saying that you are wrong, of course.  I am totally
>>>ignorant about this subject, and I ask in order to learn more.
>>
>>Process startup time, verses thread startup time can be significant.
>
>Yes, of course, but I don't see why you would want to start new
>processes except during program initialisation.  It seems to me
>that the obvious thing to do would be to start all processes at
>once during program initialisation, and keep them running
>throughout the game.  When there is no work to do, a process
>would simply return to some sort of idle loop.
>
>>An executable consumes more computer resources than a thread.
>>
>>It's not a stupendous difference.  If you look at the efficiency of Deep Sjeng
>>(which uses processes) it's really not that bad.  The place where it would hurt
>>the most is in the extremes (e.g. 8 CPUs with 4 cores each).
>
>I still haven't decided what I will use.  Threads don't really
>look that much harder to me, but perhaps I'm missing something.
>I'm sure there are lots of difficulties I won't understand before
>I try.

With a thread, every write to a global or static object MUST be gated with a
critical section or some such operation to prevent a crash.

With a process, everyone can read and write to their own copy of global data
objects because they are not shared.

For example, with:
static learn_entry_t LearnTable[NUM_OF_LEARN_ENTRIES];

In a process, you can read and write to LearnTable with impunity.

In a threaded program, you will have to ensure that only one thread writes to it
at the same time.

The same is true for every single static or global variable that is not const.
That is why I was decorating some of your public symbols with const.  In case
you want to make a threaded version some day, it will make the identification of
effort easier.




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.