Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MT search programming questions

Author: Anthony Cozzie

Date: 04:42:20 11/18/04

Go up one level in this thread


On November 18, 2004 at 04:16:48, Daniel Shawul wrote:

>On November 18, 2004 at 03:43:15, Daniel Clausen wrote:
>
>>On November 17, 2004 at 13:39:20, Robert Hyatt wrote:
>>
>>>On November 17, 2004 at 07:50:29, Daniel Shawul wrote:
>>>
>>>>I have some programming difficulties on multi threaded search.
>>>>
>>>>One problem is that allocating memory in search is a problem
>>>>
>>>>search(alpha,beta,...)
>>>>{
>>>>   SPLIT* p_split;
>>>>   p_split = new SPLIT;
>>>>
>>>>   if(search in parallel)
>>>>      searchInparallel(...)
>>>>   else
>>>>      search()
>>>>
>>>>   delete p_split;   //here it crashes
>>>>}
>>>>
>>>>The error message says "you can only delete memory from *local* heap".
>>>>Do threads have their own heap memory?
>>>
>>>Nope.  Each thread does have it's own stack memory, although any thread can
>>>see any other thread's stack if it tries hard enough since all memory is
>>>shared among threads...
>>
>>I agree with that, but I'm wondering what compiler Daniel is using? I mean, if
>>the error message from the compiler really is was he said, it must be seriously
>>broken. :)
>
>   i found this message not from a compiler warning rather as comment with in a
>library files while debugging the "delete" fucntion(which is causing the
>problem). At some point with in the fucntion there is a pointer assertion
>failure,and the comment on the code says the pointer is from a
>different heap.
>daniel
>
>
>>
>>
>>>>Another question is do i need to lock/unlock common data for threads
>>>>which is a read only type?
>>>
>>>Nope.  Only if it is modified.
>>
>>But if the common data can't be read atomically, you either need to make sure
>>noone's writing the data while someone's reading it (typically done with a
>>semaphore, which is a rather slow way for a chess engine) or you have to verify
>>the integrity of the data after the read. That or I'm missing something here. :)
>>
>>Sargon


OK, a piece of advice here.  Sit down and _design_ your algorithm.  On paper.
Don't just hack.  Sit down and think about it. "OK, what if processors A & B are
both here, what happens then".  Make sure you understand Bob's algorithms (both
Crafty and DTS) more or less, because he is the only one who has published his
:)  This will save you months in the long run.

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.