Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: CilkChess question for Don

Author: KarinsDad

Date: 12:29:52 02/02/99

Go up one level in this thread


On January 31, 1999 at 20:02:37, Bruce Moreland wrote:

>My program is single-processor single-threaded, and runs on Windows NT.  I
>decided to see what would happen if I added critical section locking to my hash
>table.
>
>I added something to the effect of ...
>
>   EnterCriticalSection(&argcs[hash.key & 1023]);
>
>... at the start of my hash table probe, a corresponding call to
>"LeaveCriticalSection" at the end of this function, another pair around the guts
>of my hash table store function, and a third pair around pawn structure
>probe/evaluate/store, and my speed dropped by approximately 10%
>
>This is in the single-threaded app.  There would be additional problems if I got
>collisions when dealing with multiple processors, but using 1024 critical
>sections should mnimize this, I think.
>
>I had been wondering about this myself, I'm glad Bob asked the question.
>
>The possibility of a mis-probe would be pretty high without locking, I'd think.
>
>bruce

Bruce,

You could try something like TryEnterCriticalSection rather than
EnterCriticalSection, however, I do not think will will speed you up a lot since
you are still having the OS do the work and the problem would occur
infrequently.

There is also the possibility of using the InterLockedExchange routine, but this
would only help you if you are exchanging only 32 bits.

Doubt this helps as much as the other manual methods recommended.

KarinsDad



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.