Author: Robert Hyatt
Date: 08:33:39 09/26/02
Go up one level in this thread
On September 26, 2002 at 02:41:34, Miguel A. Ballicora wrote:
>On September 25, 2002 at 22:20:50, Robert Hyatt wrote:
>
>>On September 25, 2002 at 17:52:19, Miguel A. Ballicora wrote:
>>
>>>On September 25, 2002 at 07:48:12, Vincent Diepeveen wrote:
>>>
>>>>Hello,
>>>>
>>>>I'm looking to a quick alternative for the windows
>>>>function WaitForSingleObject();
>>>
>>>I think that you are looking for
>>>pthread_join();
>>>
>>>That is what I use and it works exactly the same.
>>
>>
>>This is bad for several reasons.
>>
>>1. It only works for posix threads. Vincent is using plain old heavyweight
>>processes (fork()) and not threads. No way to do the join for forked
>>processes. It could be done in another way but it would be unbearably slow
>>because fork() is _really_ expensive while pthread_create is not.
>>
>>2. This means threads have to exit. It is singificantly more efficient to
>>use a "thread pool" and start the threads once, rather than stopping/starting
>>them thousands of times during a search. But again, for Vincent, this is not
>>an issue.
>
>VD was very general in his question and did not rule out posix threads. He
>mentioned that he wants to use it for an I/O thread. I see no disadvantages
>there.
>
>Miguel
He also mentioned that it needed to be done over > 128 processes. Since he
doesn't use threads of any kind, it doesn't apply to him. I happen to use
threads, as most everybody knows. But in a NUMA architecture, threads have
some quirks that heavyweight processes don't. Threads are (IMHO) easier to
use than heavyweight processes, but on NUMA machines, they actually can become
messier to deal with because it is better to duplicate often-used data rather
than having one shared copy of it, particularly if it doesn't change very
often.
>
>
>>
>>
>>
>>>
>>>I use this in windows:
>>>
>>>static void engine_thread_wait(void)
>>>{
>>> WaitForSingleObject (Engine_ID, INFINITE);
>>>}
>>>
>>>And the equivalent in Linux:
>>>
>>>static void engine_thread_wait(void)
>>>{
>>> void *p;
>>> pthread_join (Engine_ID, &p);
>>>}
>>>
>>>Regards,
>>>Miguel
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.