IP Library › Granted Patent US 10,310,914
Granted Patent B2
US 10,310,914 · App. 15/090,846 · Granted Jun 4, 2019

Methods and systems for recursively acquiring and releasing a spinlock

Inventors: Arvind Kishore Srivastava (New Delhi, IN); Randy Hilderman (Nepean, CA)
Assignee: Ciena Corporation
G06F9/526
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 10,310,914
App. No.
15/090,846
Granted
Jun 4, 2019
Kind
B2
Abstract

A computer-implemented method for a recursive spinlock includes storing a recursion level for the recursive spinlock in memory; responsive to a request to acquire the recursive spinlock by a process, performing one of (i) acquiring the recursive spinlock if not presently held by the process and incrementing the recursion level and (ii) incrementing the recursion level if the recursive spinlock is presently held by the process; and responsive to a request to release the recursive spinlock by the process, decrementing the recursion level and releasing the recursive spinlock if the recursion level is zero. The recursive spinlock can be implemented in a software wrapper used with existing software which supports recursive locks and the recursive spinlock is used in place of the recursive locks in the existing software. The computer-implemented method can be performed on a Symmetric Multiprocessor (SMP) hardware system.

Claims (37)

1. A computer-implemented method for a recursive spinlock, the computer-implemented method comprising:

storing a recursion level for the recursive spinlock in memory;

responsive to a request to acquire the recursive spinlock by a process, performing one of (i) acquiring the recursive spinlock if not presently held by the process and incrementing the recursion level and (ii) incrementing the recursion level if the recursive spinlock is presently held by the process; and

responsive to a request to release the recursive spinlock by the process, (i) decrementing the recursion level, (ii) determining the recursion level subsequent to the decrementing being negative, (iii) returning success and setting the recursion level to zero as the negative recursion level indicates the recursive spinlock was not acquired by the process,

wherein the recursion level is incremented for each acquisition including initial acquisition of the recursive spinlock by the process and recursive acquisition where the process already holds the recursive spinlock.

2. The computer-implemented method of claim 1 , wherein the recursive spinlock is implemented in a software wrapper used with existing software which supports recursive locks and the recursive spinlock is used in place of the recursive locks in the existing software.

3. The computer-implemented method of claim 1 , wherein the computer-implemented method is performed on a Symmetric Multiprocessor (SMP) hardware system.

4. The computer-implemented method of claim 1 , wherein, responsive to the request to acquire the recursive spinlock by the process, the method further comprises:

returning one of success and failure to the process based on the acquiring the recursive spinlock.

5. The computer-implemented method of claim 1 , wherein, responsive to the request to release the recursive spinlock by the process, the method further comprises:

returning one of success and failure to the process based on the releasing the recursive spinlock.

6. The computer-implemented method of claim 1 , wherein the process comprises one of

a task, an Interrupt Service Routine (ISR), and a pthread.

7. The computer-implemented method of claim 1 , wherein the acquiring and the releasing is performed via a non-recursive Operating System Application Programming Interface (API).

8. The computer-implemented method of claim 1 , wherein the computer-implemented method is performed in one or more of VxWorks and Linux.

9. The computer-implemented method of claim 1 , further comprising:

subsequent to the process releasing the recursive spinlock, preventing the process from decrementing the recursion level unless the process holds the recursive spinlock.

10. An apparatus adapted to provide a recursive spinlock, the apparatus comprising:

one or more processors; and

memory storing instructions that, when executed, cause the one or more processors to

store a recursion level for the recursive spinlock in memory,

responsive to a request to acquire the recursive spinlock by a process, perform one of (i) acquisition of the recursive spinlock if not presently held by the process and increment the recursion level and (ii) increment the recursion level if the recursive spinlock is presently held by the process, and

responsive to a request to release the recursive spinlock by the process, decrement the recursion level, release the recursive spinlock if the recursion level is zero, and return success if the recursion level is negative and set the recursion level to zero as the negative recursion level indicates the recursive spinlock was not acquired by the process,

wherein the recursion level is incremented for each acquisition including initial acquisition of the recursive spinlock by the process and recursive acquisition where the process already holds the recursive spinlock.

11. The apparatus of claim 10 , wherein the recursive spinlock is implemented in a software wrapper used with existing software which supports recursive locks and the recursive spinlock is used in place of the recursive locks in the existing software.

12. The apparatus of claim 10 , wherein the one or more processors comprise a plurality of processors in a Symmetric Multiprocessor (SMP) hardware system.

13. The apparatus of claim 10 , wherein, responsive to the request to acquire the recursive spinlock by the process, the memory storing instructions that, when executed, further cause the one or more processors to

return one of success and failure to the process based on the acquisition of the recursive spinlock.

14. The apparatus of claim 10 , wherein, responsive to the request to release the recursive spinlock by the process, the memory storing instructions that, when executed, further cause the one or more processors to

return one of success and failure to the process based on the release of the recursive spinlock.

15. The apparatus of claim 10 , wherein the process comprises one of

a task, an Interrupt Service Routine (ISR), and a pthread.

16. A non-transitory computer readable medium comprising instructions that, when executed, cause one or more processors to perform steps of:

storing a recursion level for the recursive spinlock in memory;

responsive to a request to acquire the recursive spinlock by a process, performing one of (i) acquiring the recursive spinlock if not presently held by the process and incrementing the recursion level and (ii) incrementing the recursion level if the recursive spinlock is presently held by the process; and

responsive to a request to release the recursive spinlock by the process, decrementing the recursion level, releasing the recursive spinlock if the recursion level is zero, and returning success if the recursion level is negative and setting the recursion level to zero as the negative recursion level indicates the recursive spinlock was not acquired by the process,

wherein the recursion level is incremented for each acquisition including initial acquisition of the recursive spinlock by the process and recursive acquisition where the process already holds the recursive spinlock.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 5, 2016
From: SRIVASTAVA, ARVIND KISHORE; HILDERMAN, RANDY
To: CIENA CORPORATION
Reel/Frame 038192/0205 →
Priority Claims (1)
IN 201611006024 · Feb 22, 2016 · national
Continuity (1)
Related Publication 20170242736A1 · Aug 24, 2017