Patent ID: 7234143

Claim:
A method for use in a multi-threaded system, comprising the steps of: dedicating a processor identified as a spin-yield processor to run a thread while the thread is waiting for a lock acquired by another thread; a first thread acquiring a first lock to run a program portion on a first processor, wherein running the program portion requires the first lock; and a second thread, while waiting to acquire the first lock based on a relationship between a context switching threshold and a number of context switches experienced by the second thread within a first defined time period, performs the steps of: running on the spin-yield processor; trying to acquire the first lock, wherein the second thread acquires the first lock if the first thread yields the first processor; and if the second thread does not acquire the first lock, then the second thread repeats the steps of running and trying; wherein the second thread, before running on the spin-yield processor the first time, performs the steps of: running on the first processor; and trying to acquire the first lock; if the second thread does not acquire the first lock, then the second thread repeats the steps of running on the first processor and trying to acquire the first lock.