Author: Daniel Shawul
Date: 22:07:57 11/17/04
Go up one level in this thread
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...
>
>
>>When i change in to using a split object than using a pointer it works fine.
>>but i am thinking this is slower than allocating memory when only i need to
>>split search. what do you suggest?
>
>Forget allocating memory. It is slow because it requires synchronization
>between the threads since they share the same virtual address space. The
>threads have to synchronize if two or more try to allocate something at the same
>time. No dynamic allocation inside the engine.... too slow...
>
>
>>
>>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.
>
>
>>
>>Do you block the main(parent) thread when search is split? i have read ('m not
>>sure though) this may cause a problem but it seems to work fine for me.
>
>I don't. that way I just have four threads at all times, never blocked threads
>waiting on busy threads. That is a performance reducer... It is easier to use
>your idea, but a little less efficient.
I am not sure if i understnt this part. Blocking the main thread means one
less worker,so it can't be more efficient. but it may help for communication,for
example when a fail high is reported by a thread.
daniel
>
>
>
>>
>>thanks in advance
>>daniel
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.