Scalable thread locking with customizable spinning
First Claim
1. At a computer system including at least one processor and system memory, a computer-implemented method for dynamically controlling the number of spins for a selected processing thread among a plurality of processing threads, the method comprising:
- an act of tracking both the number of waiting processing threads and each thread'"'"'s turn, wherein a selected thread'"'"'s turn comprises the total number of waiting processing threads after the selected thread'"'"'s arrival at the at least one processor;
an act of determining, based the selected thread'"'"'s turn, the number of spins that are to occur before the selected thread checks for an available thread lock;
based on the selected thread'"'"'s turn, an act of changing the number of spins for the selected thread, such that the number of spins for the selected thread is changed as a function of the number of waiting processing threads and processors in the computer system; and
wherein if the selected thread'"'"'s turn is greater than the number of processors in the computer system, the selected thread yields directly and does not spin.
2 Assignments
0 Petitions
Accused Products
Abstract
Embodiments described herein are directed to dynamically controlling the number of spins for a selected processing thread among a plurality of processing threads. A computer system tracks both the number of waiting processing threads and each thread'"'"'s turn, wherein a selected thread'"'"'s turn comprises the total number of waiting processing threads after the selected thread'"'"'s arrival at the processor. Next, the computer system determines, based the selected thread'"'"'s turn, the number of spins that are to occur before the selected thread checks for an available thread lock. The computer system also, based on the selected thread'"'"'s turn, changes the number of spins, such that the number of spins for the selected thread is a function of the number of waiting processing threads and processors in the computer system.
15 Citations
8 Claims
-
1. At a computer system including at least one processor and system memory, a computer-implemented method for dynamically controlling the number of spins for a selected processing thread among a plurality of processing threads, the method comprising:
-
an act of tracking both the number of waiting processing threads and each thread'"'"'s turn, wherein a selected thread'"'"'s turn comprises the total number of waiting processing threads after the selected thread'"'"'s arrival at the at least one processor; an act of determining, based the selected thread'"'"'s turn, the number of spins that are to occur before the selected thread checks for an available thread lock; based on the selected thread'"'"'s turn, an act of changing the number of spins for the selected thread, such that the number of spins for the selected thread is changed as a function of the number of waiting processing threads and processors in the computer system; and wherein if the selected thread'"'"'s turn is greater than the number of processors in the computer system, the selected thread yields directly and does not spin. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A computer system comprising the following:
-
one or more processors; system memory; one or more computer-readable storage media having stored thereon computer-executable instructions that, when executed by the one or more processors, causes the computing system to perform a method for dynamically controlling the number of spins for a selected processing thread among a plurality of processing threads, the method comprising the following; an act of tracking both the number of waiting processing threads and each thread'"'"'s turn, wherein a selected thread'"'"'s turn comprises the total number of waiting processing threads after the selected thread'"'"'s arrival at the processor, wherein a single integer variable is used to keep track of the waiting processing threads; an act of determining, based the selected thread'"'"'s turn, the number of spins that are to occur before the selected thread checks for an available thread lock; and based on the selected thread'"'"'s turn, an act of changing the number of spins for the selected thread, such that the number of spins for the selected thread is changed as a function of the number of waiting processing threads and processors in the computer system, wherein if the selected thread'"'"'s turn is greater than the number of processors in the computer system, the thread yields directly and does not spin.
-
Specification