IP Library Granted Patent US 9,262,233
Granted Patent B1
US 9,262,233 · App. 14/503,754 · Granted Feb 16, 2016

Second-order tuning of spin loops

Inventors: Christopher Reed (Newmarket, GB); Mark Horsburgh (Cambridge, GB); Matthew Johnson (Cambridge, GB)
Assignee: Software AG
G06F9/52
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,262,233
App. No.
14/503,754
Granted
Feb 16, 2016
Kind
B1
Abstract

A method and/or computer for a tuned spin count in a multithreaded system determines a re-calculation time interval at which to re-calculate a current spin lock value. Then, a spin-lock-re-calculation is repeatedly executed at the re-calculation time interval to perform: observing a current environment of the multithreaded system, determining, using a second-order tuning and values of the current environment, a dynamically calculated heuristic to provide the newly-recalculated spin lock value, and memorizing the newly re-calculated spin lock value, in a memory, as the current spin lock value. Meanwhile, thread(s) in the multithreaded system which want to execute a spinlock will obtain the current spin lock value which is memorized in the memory, and execute the spin lock using the current spin lock value to set a length of the spin lock.

Claims (38)

1. A method for a tuned spin count in a multithreaded system, comprising:

determining, in a processor, a re-calculation time interval at which to re-calculate a current spin lock value;

repeatedly executing, by the processor, at the re-calculation time interval, a spin-lock-re-calculation that performs steps of:

observing a current environment of the multithreaded system,

determining, using a second-order tuning and values of the current environment, a dynamically calculated heuristic to provide the newly-recalculated spin lock value, and

memorizing the newly re-calculated spin lock value, in a memory cooperatively operable with the processor, as the current spin lock value; and

obtaining, by the processor, in at least one thread, the current spin lock value which is memorized in the memory, and executing a spin lock in the at least one thread using the current spin lock value to set a length of the spin lock.

2. The method of claim 1 , wherein the re-calculation time interval at which the spin-lock-re-calculation is executed to observe the current environment is calculated as a constant ratio of a signal call time.

3. The method of claim 1 , wherein the re-calculation time interval is determined using a first-order tuning which uses an exponentially weighted moving average (EWMA) of time taken to signal another thread.

4. The method of claim 1 , wherein the current environment which is observed by the spin-lock-re-calculation and used to determine the newly-recalculated spin lock value is: contention on a run queue of an OS scheduler of the multithreaded system.

5. The method of claim 1 , wherein the current environment which is observed by the spin-lock-re-calculation and used to determine the newly-recalculated spin lock value is: load on the multithreaded system as measured by actual number of events currently on all event queues internal to all threads currently in the multithreaded system; actual number of currently runnable contexts in the multithreaded system; and moving average of time taken to signal another thread.

6. The method of claim 1 , wherein the spin-lock-re-calculation that is executed to provide the current spin lock value is executed on a dedicated thread.

7. A computer that provides a tuned spin count in a multithreaded system, comprising:

a memory, which is configured to store a current spin lock value; and

a processor cooperatively operable with the memory, and configured to:

determine a re-calculation time interval at which to re-calculate a current spin lock value;

repeatedly execute, at the re-calculation time interval, a spin-lock-re-calculation that:

observes a current environment of the multithreaded system,

determines, using a second-order tuning and values of the current environment, a dynamically calculated heuristic to provide the newly-recalculated spin lock value, and

memorizes the newly re-calculated spin lock value in the memory as the current spin lock value; and

obtain in at least one thread, the current spin lock value which is in the memory, and executing a spin lock in the at least one thread using the current spin lock value to set a length of the spin lock.

8. The computer of claim 7 , wherein the processor is further configured that the re-calculation time interval at which the spin-lock-re-calculation is executed to observe the current environment is calculated as a constant ratio of a signal call time.

9. The computer of claim 7 , wherein the processor is further configured that the re-calculation time interval is determined using a first-order tuning which uses an exponentially weighted moving average (EWMA) of time taken to signal another thread.

10. The computer of claim 7 , wherein the processor is further configured that the current environment which is observed by the spin-lock-re-calculation and used to determine the newly-recalculated spin lock value is: contention on a run queue of an OS scheduler of the multithreaded system.

11. The computer of claim 7 , wherein the processor is further configured that the current environment which is observed by the spin-lock-re-calculation and used to determine the newly-recalculated spin lock value is: load on the multithreaded system as measured by actual number of events currently on all event queues internal to all threads currently in the multithreaded system; actual number of currently runnable contexts in the multithreaded system; and moving average of time taken to signal another thread.

12. The computer of claim 7 , wherein the processor is further configured that the spin-lock-re-calculation that is executed to provide the current spin lock value is executed on a dedicated thread.

13. A non-transitory computer readable medium comprising executable instructions for a method for a tuned spin count in a multithreaded system, the instructions being executed by a processor to perform:

determining a re-calculation time interval at which to re-calculate a current spin lock value;

repeatedly executing, at the re-calculation time interval, a spin-lock-re-calculation that performs steps of:

observing a current environment of the multithreaded system,

determining, using a second-order tuning and values of the current environment, a dynamically calculated heuristic to provide the newly-recalculated spin lock value, and

memorizing the newly re-calculated spin lock value, in a memory cooperatively operable with the processor, as the current spin lock value; and

obtaining, in at least one thread, the current spin lock value which is memorized in the memory, and executing a spin lock in the at least one thread using the current spin lock value to set a length of the spin lock.

14. The non-transitory computer readable medium of claim 13 , wherein the re-calculation time interval at which the spin-lock-re-calculation is executed to observe the current environment is calculated as a constant ratio of a signal call time.

15. The non-transitory computer readable medium of claim 13 , wherein the re-calculation time interval is determined using a first-order tuning which uses an exponentially weighted moving average (EWMA) of time taken to signal another thread.

16. The non-transitory computer readable medium of claim 13 , wherein the current environment which is observed by the spin-lock-re-calculation and used to determine the newly-recalculated spin lock value is: contention on a run queue of an OS scheduler of the multithreaded system.

17. The non-transitory computer readable medium of claim 13 , wherein the current environment which is observed by the spin-lock-re-calculation and used to determine the newly-recalculated spin lock value is: load on the multithreaded system as measured by actual number of events currently on all event queues internal to all threads currently in the multithreaded system; actual number of currently runnable contexts in the multithreaded system; and moving average of time taken to signal another thread.

18. The non-transitory computer readable medium of claim 13 , wherein the spin-lock-re-calculation that is executed to provide the current spin lock value is executed on a dedicated thread.

Assignments (3)
MERGER Recorded Dec 17, 2024
From: SOFTWARE AG
To: MOSEL BIDCO AG
Reel/Frame 069888/0666 →
CHANGE OF NAME Recorded Dec 17, 2024
From: MOSEL BIDCO AG
To: SOFTWARE GMBH
Reel/Frame 069888/0673 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 1, 2014
From: REED, CHRISTOPHER; HORSBURGH, MARK, DR.; JOHNSON, MATTHEW
To: SOFTWARE AG
Reel/Frame 033862/0686 →