Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Approaches to threading

Author: Anthony Cozzie

Date: 15:19:59 06/15/04

Go up one level in this thread


On June 15, 2004 at 17:24:59, Eric Oldre wrote:

>
>First off, I've taken everyone's advice from last week and changed my engine so
>that most functions take a pointer to a board object as a parameter instead of
>operating on a global board.
>
>I now have it doing a basic alpha-beta search with QSearch, a basic evaluation,
>and MMV/LVA move ordering. It is also returning and printing out the PV.
>
>At this point (having hardly anything tuned) it's already as fast as my old
>engine in vb.net. Although as I improve the evaluation it will slow down of
>course.
>
>My next step is to get it implementing the winboard protocol, perhaps UCI as
>well. I've decided to take a approach where i have the main thread read commands
>from winboard, and a separate "thinker" thread work on the problem. similar in
>concept to what i saw in the Gerbil source.
>
>Since this is the first program I've written in C. I don't have much experience
>with multi-threading in C. I've started to create something using the
>CreateThread and ExitThread calls in <windows.h>. I was wondering if people felt
>that was a good idea, or if I'd be better off trying to learn about POSIX
>threading.
>
>Is there a 3rd approach to look at?
>
>Is there a performance advantage to either?
>
>Does one have a much easier learning curve than the other? What i've done so far
>with the <windows.h> stuff hasn't seemed to difficult to grasp, but I'm not
>terribly far along yet.
>
>Thanks,
>Eric Oldre

My advice: just poll every so often.  Threaded code is _tough_ to debug.  I've
had 4 different IO thread implementations in Zappa to date.  I'm 99% sure I have
it down now, but it really wasn't worth it.  Humans are simply bad at parallel
programming.

anthony



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.