Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: basic multithreading question

Author: Robert Hyatt

Date: 11:36:32 11/09/04

Go up one level in this thread


On November 09, 2004 at 09:47:07, Anthony Cozzie wrote:

>On November 09, 2004 at 01:32:53, Daniel Shawul wrote:
>
>>hi
>>i don't know anything about multi threading,but i
>>have plan to make my engine a parallel searcher.
>>few basic questions
>>
>>  1.Can I program on a single CPU computer?or Do i need at least a dual?
>>
>>  2.if (1) is possible,can i be sure it works on a dual.
>>
>>  3.Do i need to write different code for different OS(windows and linux).
>>     Or is it part of the C Language.
>>  4. Last but very important, where can i get a good tutorial(basic) on multi-
>>  threading in c/c+=, or a good book.
>>
>>thanks in advance
>>daniel
>
>I am not sure I want to see a parallel DanChess, but here goes :)
>
>The problem with parallel programming is all the race conditions: two cpus try
>to do something at the same time; who wins?  In theory, I believe that the task
>switching of the OS will simulate 2 processors, but it will take WAY longer, so
>in practice you need a dual.  The good news is that they are very cheap
>nowadays; just buy a P4 with HT.
>
>For parallel programming most people use pthreads on linux or the windows api
>(beginthread/Createthread, EnterCriticalSection, etc) on windows.  However, you
>will have to write spinlocks, because you don't want the OS to swap you out.
>You either write your own (its not that hard, and rather fun), or you can copy
>Crafty's; I believe Bob stole his from the linux kernel.  Zappa uses CMPXCHG
>rather than XCHG (merely for amusement, read Herlihy's paper on wait-free
>synchronization), but its of course up to you.
>
>Lastly, i recommended ABDADA, simply because it is the easiest to implement.  It
>doesn't give very good performance for large numbers of processors, but who has
>access to lots of processors anyway :)  I did a full DTS implementation in Zappa
>to prove my manliness, but it still doesn't work on >2 procs, was a lot of work,
>and split-anywhere is only a few % faster than a Crafty style splitting
>algorithm, which is probably only a few % faster than ABDADA.  I may get better
>results when I improve my move-ordering; we shall see.
>
>Good luck!  If you have problems, you can always ask me, or Bob has about 500
>years of experience doing this :)
>
>anthony

I don't believe _any_ parallel search is only a few percent faster than ABDADA.
ABDADA is so completely bad...  Even on a dual, much less on 4-way and 8-way
boxes.




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.