Scalable thread locking with customizable spinning
AssigneeMicrosoft Corporation
InventorsEmad A. Omara, John J. Duffy
Life of this patent
Estimating the term…
Loading patent…
AssigneeMicrosoft Corporation
InventorsEmad A. Omara, John J. Duffy
Estimating the term…
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 on 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.
A computer program product comprising the following:
A computer system comprising the following:
A method comprising the following:
Dependencies are inferred from the claim text.
Drawings are temporarily unavailable. Open the PDF at USPTO
Computers have become highly integrated in the workforce, in the home, in mobile devices, and many other places. Computers can process massive amounts of information quickly and efficiently. Software applications designed to run on computer systems allow users to perform a wide variety of functions including business applications, schoolwork, entertainment and more. Software applications are often designed to perform specific tasks, such as word processor applications for drafting documents, or email programs for sending, receiving and organizing email.
In many cases, software applications are designed to interact with other software applications or other computer systems. In some systems, such as parallel processing systems, multiple threads are used to process various portions of a software application. Processing threads can be assigned to a particular task such as application input/output (I/O) and can be reassigned as needed. At times, a thread (such as one assigned to I/O) may be left in a waiting state, where the thread is waiting for an input before it can process the next instruction. In such cases, the thread is said to be “spinning” or waiting in a loop. In such a state, the thread is typically designed to repeatedly check for the necessary input. If the thread does not receive the input for a certain amount of time, the thread “blocks” or goes to sleep.
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.
To further clarify the above and other advantages and features of embodiments of the present invention, a more particular description of embodiments of the present invention will be rendered by reference to the appended drawings. It is appreciated that these drawings depict only typical embodiments of the invention and are therefore not to be considered limiting of its scope. The invention will be described and explained with additional specificity and detail through the use of the accompanying drawings in which:
FIG. 1 illustrates a computer architecture in which embodiments of the present invention may operate including dynamically controlling the number of spins for a selected processing thread among a plurality of processing threads.
FIG. 2 illustrates a flowchart of an example method for dynamically controlling the number of spins for a selected processing thread among a plurality of processing threads.
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 on 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.
In another embodiment, a computer system initializes a single integer variable configured to keep track of the following: the status of a lock bit indicating whether a lock has been acquired or not, a number of waiting threads, and the status of a thread tracking flag. Next, the computer system checks the lock bit to determine whether the lock is available for a selected processing thread. The computer system also, upon determining that the lock is available, assigns the lock to the selected processing thread.
The following discussion now refers to a number of methods and method acts that may be performed. It should be noted, that although the method acts may be discussed in a certain order or illustrated in a flow chart as occurring in a particular order, no particular ordering is necessarily required unless specifically stated, or required because an act is dependent on another act being completed prior to the act being performed.
From the US filing history. Foreign family members aren’t listed.
Task transfer initiation or dispatching: by program, e.g. task dispatcher, supervisor, operating system
Program synchronisation; Mutual exclusion, e.g. by means of semaphores: mutual exclusion algorithms
Computing and data processing
About 3 years 1 month of term left · ends 24 Nov 2029 (estimated)