Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: bugged code

Author: Matt Taylor

Date: 18:27:13 02/25/03

Go up one level in this thread


On February 25, 2003 at 18:53:53, Vincent Diepeveen wrote:

>On February 25, 2003 at 13:28:43, Matt Taylor wrote:
>
>hello are you trying to measure the quantum of a thread in your code?
>
>how does this measure how fast a thread gets signalled *anyhow* with
>WaitForSingleObject?
<snip>

Yes, I am measuring a thread quantum. WaitForSingleObject can potentially switch
faster (on the order of nanoseconds possibly, definitely a few microseconds at
worst), but that's not the issue -- Crafty isn't using WaitForSingleObject.
Crafty is using its own custom spin lock.

You asserted that Crafty would spin on the locked data until its timeslice (or
quantum) was up. That just isn't true unless someone is dumb enough to run mt=2
with 1 processor in their system. I think Crafty even has code to prevent that,
but I'm not sure. With 1 thread, it is not possible to block on your own locks
unless you have a bug. The spin lock is very fast, faster than making a function
call (neglecting the fact that the function is going to do the same thing). This
equates to a few nanoseconds.

-Matt



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.