Author: Robert Hyatt
Date: 20:10:31 12/03/02
Go up one level in this thread
On December 02, 2002 at 23:59:51, Matt Taylor wrote: >>How can you use the hlt instruction? It's privileged, and you're in ring 3. > >Nevermind. I forgot that the P4 introduced a pause instruction to reduce the >rate that spin loops execute at, creating less contention on the bus and >allowing the processor to run cooler. The pause instruction -ISN'T- privileged. The main issue is not bus contention. Everybody uses a "shadow lock" approach so that we spin on a cache value rather than repeatedly beating on the xchg instruction and frying the bus. But you don't want one thread spinning like mad doing no useful work, while the other thread actually holds the lock but is currently waiting for cpu cycles because the SMT scheduler has chosen to execute micro-ops from the _spinning_ thread. That is why crafty does poorly on a non-dedicated SMP machine, and hyper-threading simply produces the same problem. The pause will solve it for hyper-threading, but doesn't help a bit on the non-dedicated machine case. There spinlocks are worse than mutexes that physically block the thread, although I am playing with a sched_yield() system call that does the same thing to the linux kernel as the pause does to the SMT core.
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.