IP Library Granted Patent US 9,477,471
Granted Patent B1
US 9,477,471 · App. 14/793,635 · Granted Oct 25, 2016

Maintaining lock-free, high frequency, high performance counters in software

Inventors: Sridhar Vishwanathan Iyer (Sunnyvale, CA); Apurva Mehta (Cupertino, CA)
Assignee: VERSA NETWORKS, INC.
G06F9/3009G06F9/5016G06F9/5022
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,477,471
App. No.
14/793,635
Granted
Oct 25, 2016
Kind
B1
Abstract

A first and second thread-local counter is allocated to a first and second thread respectively, where the first thread-local counter is updatable only by or on behalf of the first thread and the second thread-local counter is updatable only by or on behalf of the second thread. The first and second thread-local counter are updated and the updated values are communicated to a central process. The central process updates a single counter in a central database by a value equal to the sum of the updated counter values.

Claims (37)

1. A method for implementing counters in software, comprising:

allocating a first thread-local counter to a first thread and allocating a second thread-local counter to a second thread, wherein the first thread-local counter is updatable only by or on behalf of the first thread and the second thread-local counter is updatable only by or on behalf of the second thread, and wherein the first thread-local counter and the second thread-local counter are each identifiable by a same name or same identifier;

updating, by the first thread, a first value of the first thread-local counter;

updating, by the second thread, a second value of the second thread-local counter;

communicating, to a central process, the updated first value, the updated second value, a first identifier associated with the updated first value, and a second identifier associated with the updated second value;

determining, by the central process, using the first identifier associated with the updated first value and the second identifier associated with the updated second value, that the updated first value and the updated second value belong to a same counter; and

updating, by the central process, the same counter in a central database by a value equal to a sum of the updated first value and the updated second value.

2. The method of claim 1 , further comprising:

responsive to receiving a query at the central database for the value of the same counter, providing a current value of the same counter.

3. The method of claim 1 , wherein the first thread and the second thread are threads executing on a first processor and a second processor respectively.

4. The method of claim 1 , wherein the first thread and the second thread are threads executing on a first core and a second core of a single processor.

5. The method of claim 1 , wherein the updated first value and the updated second value are communicated to the central process in response to a timer expiring.

6. An apparatus for implementing counters in software, comprising:

a set of one or more processors and a set of one or more non-transitory machine-readable storage media, wherein the set of one or more non-transitory machine-readable storage media store instructions executable by the set of one or more processors to cause said apparatus to:

allocate a first thread-local counter to a first thread and allocate a second thread-local counter to a second thread, wherein the first thread-local counter is updatable only by or on behalf of the first thread and the second thread-local counter is updatable only by or on behalf of the second thread, and wherein the first thread-local counter and the second thread-local counter are each identifiable by a same name or same identifier;

update, by the first thread, a first value of the first thread-local counter;

update, by the second thread, a second value of the second thread-local counter;

communicate, to a central process, the updated first value, the updated second value, a first identifier associated with the updated first value, and a second identifier associated with the updated second value;

determine, by the central process, using the first identifier associated with the updated first value and the second identifier associated with the updated second value, that the updated first value and the updated second value belong to a same counter; and

update, by the central process, the same counter in a central database by a value equal to a sum of the updated first value and the updated second value.

7. The apparatus of claim 6 , wherein the set of one or more non-transitory machine-readable storage media store instructions executable by the set of one or more processors to further cause said apparatus to:

in response to receipt of a query at the central database for the value of the same counter, provide a current value of the same counter.

8. The apparatus of claim 6 , wherein the first thread and the second thread are threads executing on a first processor of the set of one or more processors and a second processor of the set of one or more processors respectively.

9. The apparatus of claim 6 , wherein the first thread and the second thread are threads executing on a first core and a second core of a single processor of the set of one or more processors.

10. The apparatus of claim 6 , wherein the updated first value and the updated second value are communicated to the central process in response to a timer expiring.

11. A non-transitory machine-readable storage medium that stores instructions that, if executed by a set of one or more processors, cause said set of one or more processors to perform operations comprising:

allocating a first thread-local counter to a first thread and allocating a second thread-local counter to a second thread, wherein the first thread-local counter is updatable only by or on behalf of the first thread and the second thread-local counter is updatable only by or on behalf of the second thread, and wherein the first thread-local counter and the second thread-local counter are each identifiable by a same name or same identifier;

updating, by the first thread, a first value of the first thread-local counter;

updating, by the second thread, a second value of the second thread-local counter;

communicating, to a central process, the updated first value, the updated second value, a first identifier associated with the updated first value, and a second identifier associated with the updated second value;

determining, by the central process, using the first identifier associated with the updated first value and the second identifier associated with the updated second value, that the updated first value and the updated second value belong to a same counter; and

updating, by the central process, the same counter in a central database by a value equal to a sum of the updated first value and the updated second value.

12. The non-transitory machine-readable storage medium of claim 11 , wherein the non-transitory machine-readable storage medium further stores instructions, that when executed by the set of one or more processors, cause the set of one or more processors to perform the following operation:

responsive to receiving a query at the central database for the value of the same counter, providing a current value of the same counter.

13. The non-transitory machine-readable storage medium of claim 11 , wherein the first thread and the second thread are threads executing on a first processor of the set of one or more processors and a second processor of the set of one or more processors respectively.

14. The non-transitory machine-readable storage medium of claim 11 , wherein the first thread and the second thread are threads executing on a first core and a second core of a single processor of the set of one or more processors.

15. The non-transitory machine-readable storage medium of claim 11 , wherein the updated first value and the updated second value are communicated to the central process in response to a timer expiring.

Assignments (6)
RELEASE OF SECURITY INTEREST Recorded Jan 27, 2025
From: SILICON VALLEY BANK, AS ADMINISTRATIVE AGENT
To: VERSA NETWORKS, INC.
Reel/Frame 070010/0374 →
RELEASE OF SECURITY INTEREST Recorded Jan 27, 2025
From: SILICON VALLEY BANK
To: VERSA NETWORKS, INC.
Reel/Frame 070010/0384 →
SECURITY INTEREST Recorded Oct 20, 2023
From: VERSA NETWORKS, INC.
To: JPMORGAN CHASE BANK, N.A.
Reel/Frame 065289/0303 →
SECURITY INTEREST Recorded Mar 29, 2022
From: VERSA NETWORKS, INC.
To: SILICON VALLEY BANK
Reel/Frame 059423/0004 →
SECURITY INTEREST Recorded Mar 29, 2022
From: VERSA NETWORKS, INC.
To: SILICON VALLEY BANK, AS ADMINISTRATIVE AGENT
Reel/Frame 059423/0028 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 7, 2015
From: IYER, SRIDHAR VISHWANATHAN; MEHTA, APURVA
To: VERSA NETWORKS, INC.
Reel/Frame 036015/0854 →