IP Library Granted Patent US 7,366,956
Granted Patent B2
US 7,366,956 · App. 10/870,722 · Granted Apr 29, 2008

Detecting data races in multithreaded computer programs

Assignee: Hewlett-Packard Development Company, L.P.
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 7,366,956
App. No.
10/870,722
Filed
Jun 16, 2004
Granted
Apr 29, 2008
Kind
B2
Art Unit
2113
USPC
714/38
Abstract

In one aspect, a value of a variable shared by multiple threads for executing the program code is stored in a thread-local variable. A data race condition is detected based on a comparison of values of the shared variable and the thread-local variable. Detection of the data race condition is reported. In another aspect, a machine-readable instruction to store in a thread-local variable a value of a variable shared by multiple threads for executing the program code is generated. A machine-readable instruction to detect a data race condition based on a comparison of values of the shared variable and the thread-local variable is generated. The machine-readable instructions are stored in a machine-readable medium.

Claims (38)

1. A machine-implemented method of processing program code, comprising:

storing in a thread-local variable a value of a variable shared by multiple threads for executing the program code;

detecting a data race condition based on a comparison of values of the shared variable and the thread-local variable; and

reporting detection of the data race condition.

2. The method of claim 1 , wherein the shared variable value is stored to the thread-local variable during execution of at least a given one of the threads sharing the shared variable.

3. The method of claim 2 , wherein the data race condition is detected during execution of the given thread.

4. The method of claim 3 , wherein the detection of the data race condition is reported during execution of the given thread.

5. The method of claim 1 , further comprising comparing the values of the shared variable and the thread-local variable after the shared variable value is stored in the thread-local variable, and subsequently loading the shared variable value.

6. The method of claim 1 , wherein the data race condition is detected based on a determination that the values of the shared variable and the thread-local variable are different.

7. The method of claim 1 , wherein the reporting comprises reporting a detection of the data race condition in response to a determination that the values of the shared variable and the thread-local variable are different.

8. A machine-readable medium storing machine-readable instructions for causing a machine to:

store in a thread-local variable a value of a variable shared by multiple threads for executing the program code;

detect a data race condition based on a comparison of values of the shared variable and the thread-local variable; and

report detection of the data race condition.

9. The machine-readable medium of claim 8 , wherein the machine-readable instructions cause a machine to store the shared variable value to the thread-local variable during execution of at least a given one of the threads sharing the shared variable.

10. The machine-readable medium of claim 9 , wherein the machine-readable instructions cause a machine to detect the data race condition during execution of the given thread.

11. The machine-readable medium of claim 10 , wherein the machine-readable instructions cause a machine to report the detection of the data race condition during execution of the given thread.

12. The machine-readable medium of claim 8 , wherein the machine-readable instructions cause a machine to compare the values of the shared variable and the thread-local variable after the shared variable value is stored in the thread-local variable, and to subsequently load the shared variable value.

13. The machine-readable medium of claim 8 , wherein the machine-readable instructions cause a machine to detect the data race condition based on a determination that the values of the shared variable and the thread-local variable are different.

14. The machine-readable medium of claim 8 , wherein the machine-readable instructions cause a machine to report a detection of the data race condition in response to a determination that the values of the shared variable and the thread-local variable are different.

15. A machine-implemented method of processing program code, comprising:

generating a machine-readable instruction to store in a thread-local variable a value of a variable shared by multiple threads for executing the program code;

generating a machine-readable instruction to detect a data race condition based on a comparison of values of the shared variable and the thread-local variable; and

storing the machine-readable instructions in a machine-readable medium.

16. The method of claim 15 , further comprising generating a machine-readable instruction to report detection of the data race condition.

17. The method of claim 15 , further comprising identifying the shared variable.

18. The method of claim 15 , further comprising identifying an access to the shared variable to test for occurrence of a data race condition.

19. The method of claim 15 , further comprising determining whether an instruction in the program code stores a value to the shared variable.

20. The method of claim 19 , wherein the machine-readable instruction to store the shared variable value to the thread-local variable is generated in response to a positive determination that the program code instruction stores a value to the shared variable.

21. The method of claim 19 , wherein the machine-readable instruction to detect the data race condition is generated in response to a negative determination that the program code instruction stores a value to the shared variable.

22. A machine-readable medium storing machine-readable instructions for causing a machine to:

generate a machine-readable instruction to store in a thread-local variable a value of a variable shared by multiple threads for executing the program code;

generate a machine-readable instruction to detect a data race condition based on a comparison of values of the shared variable and the thread-local variable; and

store the machine-readable instructions in a machine-readable medium.

23. The machine-readable medium of claim 22 , wherein the machine-readable instructions cause a machine to generate a machine-readable instruction to report detection of the data race condition.

24. The machine-readable medium of claim 22 , wherein the machine-readable instructions cause a machine to identify the shared variable.

25. The machine-readable medium of claim 22 , wherein the machine-readable instructions cause a machine to identify an access to the shared variable to test for occurrence of a data race condition.

26. The machine-readable medium of claim 22 , wherein the machine-readable instructions cause a machine to determine whether an instruction in the program code stores a value to the shared variable.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 9, 2015
From: HEWLETT-PACKARD DEVELOPMENT COMPANY, L.P.
To: HEWLETT PACKARD ENTERPRISE DEVELOPMENT LP
Reel/Frame 037079/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 16, 2004
From: KARP, ALAN H.; COLLARD, JEAN-FRANCOIS C.
To: HEWLETT-PACKARD DEVELOPMENT COMPANY, L.P.
Reel/Frame 015490/0526 →
Continuity (1)
Related Publication 20050283781A1 · Dec 22, 2005