IP Library Granted Patent US 8,966,496
Granted Patent B2
US 8,966,496 · App. 13/314,328 · Granted Feb 24, 2015

Lock free use of non-preemptive system resource

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 8,966,496
App. No.
13/314,328
Granted
Feb 24, 2015
Kind
B2
Abstract

A computer-implemented method for lock-free use of a non-preemptive system resource by a preemptive thread, which may be interrupted. The method comprises registering a non-preemptive system resource and a first level reclaim handler for the non-preemptive system resource with the kernel of an operating system, registering a second level reclaim handler with the kernel, wherein the second level reclaim handler is included in an application program, and running the application program as a preemptive thread using the non-preemptive system resource. The first level reclaim handler is code that is a part of the implementation of the non-preemptive system resource in the kernel. The second level reclaim handler is code that is part of the application and is registered with the kernel before the application uses the non-preemptive system resource. The method enables a preemptive thread using a non-preemptive system resource to be preempted without crashing.

Claims (38)

1. A computer-implemented method comprising:

registering a non-preemptive system resource and a first level reclaim handler for the non-preemptive system resource with the kernel of an operating system in a computer system;

registering a second level reclaim handler with the kernel, wherein the second level reclaim handler is code that is part of an application program;

running the application program as a preemptive thread using the non-preemptive system resource; and

dispatching the preemptive thread while the preemptive thread is using the non-preemptive system resource; and

in response to the preemptive thread being dispatched while using the non-preemptive system resource, the first handler revising the context of the preemptive thread so that the preemptive thread will resume in the second level handler such that the second handler reclaims back the non-preemptive resource.

2. The method of claim 1 , wherein the first level reclaim handler is code that is a part of the implementation of the non-preemptive system resource in the kernel.

3. The method of claim 1 , wherein the second level reclaim handler is registered with the kernel before the application uses the non-preemptive system resource.

4. The method of claim 1 , wherein the preemptive thread is dispatched by a dispatch handler of a scheduler process, the method further comprising:

the dispatch handler instructing the first level handler to revise the context of the preemptive thread so that the preemptive thread will resume in the second level handler in response to resuming the preemptive thread.

5. The method of claim 4 , further comprising:

the first level handler revising the context of the preemptive thread by recording an instruction address of the second level handler for the application as part of the context for the preemptive thread, wherein the preemptive thread will resume in the second level handler at the instruction address recorded in the context.

6. The method of claim 4 , wherein the preempted thread is placed in a run queue.

7. The method of claim 4 , further comprising:

the dispatch handler resuming the preemptive thread;

the revised context for the preemptive thread causing the preemptive thread to resume in the second level reclaim handler; and

the dispatch handler determining whether the non-preemptive system resource is available.

8. The method of claim 7 , further comprising:

in response to determining that the non-preemptive system resource is available at the time the thread is resumed, the dispatch handler instructing the second level reclaim handler to resume use of the non-preemptive system resource.

9. The method of claim 7 , further comprising:

in response to determining that the non-preemptive system resource is not available at the time the thread is resumed, the dispatch handler instructing the second level reclaim handler cleaning up a thread state of the thread so that the thread can resume normally without crashing.

10. The method of claim 7 , further comprising:

the second level reclaim handler handling any errors; and then

the second level reclaim handler reclaiming the non-preemptive resource.

11. The method of claim 1 , further comprising:

dispatching the thread in response to timer interrupt to switch processes.

12. The method of claim 8 , further comprising:

the second level handler reclaiming the resource in response to determining that the non-preemptive system resource is no longer allocated to the preemptive thread.

13. The method of claim 4 , wherein the preemptive thread using a non-preemptive system resource can be preempted without crashing the preemptive thread.

14. The method of claim 1 , wherein the non-preemptive resource is a non-preemptive region of code.

15. The method of claim 14 , further comprising:

registering the non-preemptive region of code with the kernel; and

identifying an address range where the non-preemptive region of code is stored.

16. The method of claim 15 , further comprising:

the first level reclaim handler comparing a current instruction register of the thread with the address range of the non-preemptive region of code to determine whether the thread is using the non-preemptive region of code.

17. The method of claim 1 , wherein the non-preemptive resource is a global code region that can be used by more than one thread at a time.

18. The method of claim 17 , wherein the global code region is low memory.

19. The method of claim 1 , wherein the preemptive thread can access a non-preemptive system resource without using a lock.

Assignments (5)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 6, 2019
From: LENOVO ENTERPRISE SOLUTIONS (SINGAPORE) PTE LTD.
To: LENOVO INTERNATIONAL LIMITED
Reel/Frame 050300/0721 →
CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNMENT DOCUMENT CONTAINING TYPO ERRORS PREVIOUSLY RECORDED AT REEL: 037101 FRAME: 0969. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT. Recorded Dec 28, 2015
From: LENOVO ENTERPRISE SOLUTIONS (SINGAPORE) PTE. LTD.
To: LENOVO INTERNATIONAL LIMITED
Reel/Frame 037689/0190 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 12, 2015
From: LENOVO ENTERPRISE SOLUTIONS (SINGAPORE) PTE. LTD.
To: LENOVO INTERNATIONAL LIMITED
Reel/Frame 037101/0969 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 10, 2014
From: INTERNATIONAL BUSINESS MACHINES CORPORATION
To: LENOVO ENTERPRISE SOLUTIONS (SINGAPORE) PTE. LTD.
Reel/Frame 034194/0111 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 8, 2011
From: BHAT, KAVANA N.; CHANDRAN, SHAJITH; SINHA, SAMEER K.; SRINIVASAN, MUTHULAKSHMI P.
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 027353/0034 →