Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Threads

Author: Bruce Moreland

Date: 23:24:46 04/07/99

Go up one level in this thread



On April 08, 1999 at 00:28:11, Dave Gomboc wrote:

>If the resource that you are waiting on is being used by a process that is
>blocked, then block, otherwise spin.  Does that make sense?  It assumes that one
>can tell which process has control of the resource.  I am far from an expert in
>this area.

You'd hope that a thread wouldn't block while it has control of a resource.

These multithreading/multiprocessing discussions are interesting, but it's
confusing trying to figure out exactly what we are talking about.

The original example some time ago involved not writing into a hash element
while someone else is reading from it or writing to it.

There are also issues of thread synchronization when dividing search work.

There could be other places where it's necessary to do some synchronization, for
instance when accessing a shared resource such as an endgame database module.
In this case you could sit on a resource for a while, since you might block
while doing I/O.

And I believe we are mainly talking about multithreading when each thread has
more or less exclusive access to a processor, which has to be somewhat different
than handling several threads that are sharing one processor.  It makes sense
that it would be less crazy to do some sort of spin lock in this situation.

I've used Eugene's locking code almost directly, and with a few variants.  I
haven't found a case where it works a lot better than critical sections.  Even
that simple assembly code seems to kick the heck out of performance if you run
that code every now and then, even in a single-threaded app (where there is no
contention for resources, so all locks immediately succeed).

I would be very happy to hear about others' experience with multithreaded chess
applications, particularly under NT.

Mostly I think we are talking about locks that almost always succeed, and when
they fail they only fail for a short period of time.  I've tried to track the
time mine spends sitting waiting on a lock, and totalled up it's typically a
couple of seconds in a 210 second run with 4 processors.  That's with critical
sections.

bruce



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.