|
From: Wayne S. <body1233_@_yahoo> - 2005-06-29 17:54:33
|
http://www.intel.com/cd/ids/developer/asmo-na/eng/196575.htm?page=5 Excerpts: "With Hyper-Threading Technology, spin-wait loops can delay the completion of one thread when another thread holds a lock, because the looping thread is repeatedly scheduled and executed, consuming vital shared resources in its loop." "Use the PAUSE Instruction to Optimize Code Intel recommends that software developers always use the PAUSE instruction in spin-wait loops. Starting with the Intel® Pentium® 4 processor, this recommendation was made for the benefit of power savings. Executing a PAUSE in a spin-wait loop forces the spin-wait to finish one iteration of the loop before starting the next iteration. Halting the spin-wait loop reduces consumption of non-productive resources - and thus power. With a Hyper-Threading Technology supported processor, using the PAUSE instruction optimizes processing of two threads. Pausing the spin-wait loop frees more resources for the other processor, allowing faster completion of its thread." "Your code should use the OS SYNCHRONIZATION techniques when the lock is suspected to be longer than an OS quantum. Use a spin-wait PAUSE command to wait for a lock when it's suspected to last less than an OS quantum." |