Techniques and systems for data race detection
First Claim
1. A method performed by data processing apparatus, comprising:
- running two or more threads of a multithreaded program on a processor, the program being configured to;
produce locksets, each of which indicate a set of one or more locks that a thread holds at a point in time; and
cause a hardware implemented performance monitoring unit included in the processor to i) monitor memory accesses caused by the threads, ii) produce samples based on the memory accesses, each sample indicating an accessed memory location, wherein a sampling rate of the samples is controlled based on an overhead parameter, and iii) produce a separate processor interrupt for each sample;
aligning, using each separate processor interrupt produced for each sample by the performance monitoring unit, the samples produced by the performance monitoring unit with locksets produced by the program; and
determining an existence of a data race condition based on the samples and the locksets, the determining comprising;
(i) identifying, from a first lockset of the locksets and a first sample of the samples produced for a first thread of the two or more threads, a protected access, by the first thread, to a memory location indicated by the first sample;
(ii) identifying, from the first lockset and a second sample of the samples produced for a second thread of the two or more threads, an unprotected access, by the second thread, to the memory location indicated by the second sample; and
(iii) determining the data race condition exists based on the identified protected access and the identified unprotected access; and
selectively outputting an indication of the data race condition.
2 Assignments
0 Petitions
Accused Products
Abstract
A race detection mechanism can include running threads of a multithreaded program on a processor, the program being configured to produce locksets each of which indicate a set of one or more locks that a thread holds at a point in time. The mechanism can cause a performance monitoring unit included in the processor to monitor memory accesses caused by the threads and to produce samples based on the memory accesses, the samples being indicative of an accessed memory location. The mechanism can detect an existence of a data race condition based on the samples and the locksets. Detecting can include identifying a protected access to a memory location by a first thread of the threads and identifying an unprotected access to the memory location by a second thread of the threads. The process selectively outputs an indication of the data race condition.
-
Citations
15 Claims
-
1. A method performed by data processing apparatus, comprising:
-
running two or more threads of a multithreaded program on a processor, the program being configured to; produce locksets, each of which indicate a set of one or more locks that a thread holds at a point in time; and cause a hardware implemented performance monitoring unit included in the processor to i) monitor memory accesses caused by the threads, ii) produce samples based on the memory accesses, each sample indicating an accessed memory location, wherein a sampling rate of the samples is controlled based on an overhead parameter, and iii) produce a separate processor interrupt for each sample; aligning, using each separate processor interrupt produced for each sample by the performance monitoring unit, the samples produced by the performance monitoring unit with locksets produced by the program; and determining an existence of a data race condition based on the samples and the locksets, the determining comprising; (i) identifying, from a first lockset of the locksets and a first sample of the samples produced for a first thread of the two or more threads, a protected access, by the first thread, to a memory location indicated by the first sample; (ii) identifying, from the first lockset and a second sample of the samples produced for a second thread of the two or more threads, an unprotected access, by the second thread, to the memory location indicated by the second sample; and (iii) determining the data race condition exists based on the identified protected access and the identified unprotected access; and selectively outputting an indication of the data race condition. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A system, comprising:
-
a computer storage device having instructions stored thereon; and a processor coupled to the computer storage device, the processor comprising a performance monitoring unit, wherein the instructions, when executed by the processor, cause the processor to perform operations comprising; running two or more threads of a multithreaded program on a processor, the program being configured to; produce locksets, each of which indicate a set of one or more locks that a thread holds at a point in time; and cause a hardware implemented performance monitoring unit included in the processor to i) monitor memory accesses caused by the threads, ii) produce samples based on the memory accesses, each sample indicating an accessed memory location, wherein a sampling rate of the samples is controlled based on an overhead parameter, and iii) produce a separate processor interrupt for each sample; aligning, using each separate processor interrupt produced for each sample by the performance monitoring unit, the samples produced by the performance monitoring unit with locksets produced by the program; and determining an existence of a data race condition based on the samples and the locksets, the determining comprising; (i) identifying, from a first lockset of the locksets and a first sample of the samples produced for a first thread of the two or more threads, a protected access, by the first thread, to a memory location indicated by the first sample; (ii) identifying, from the first lockset and a second sample of the samples produced for a second thread of the two or more threads, an unprotected access, by the second thread, to the memory location indicated by the second sample; and (iii) determining the data race condition exists based on the identified protected access and the identified unprotected access; and selectively outputting an indication of the data race condition. - View Dependent Claims (7, 8, 9, 10)
-
-
11. A non-transitory computer readable medium encoded with a computer program, the program comprising instructions that when executed by data processing apparatus cause the data processing apparatus to perform operations comprising:
-
running two or more threads of a multithreaded program on a processor, the program being configured to; produce locksets, each of which indicate a set of one or more locks that a thread holds at a point in time; and cause a hardware implemented performance monitoring unit included in the processor to i) monitor memory accesses caused by the threads, ii) produce samples based on the memory accesses, each sample indicating an accessed memory location, wherein a sampling rate of the samples is controlled based on an overhead parameter, and iii) produce a separate processor interrupt for each sample; aligning, using each separate processor interrupt produced for each sample by the performance monitoring unit, the samples produced by the performance monitoring unit with locksets produced by the program; and determining an existence of a data race condition based on the samples and the locksets, the determining comprising; (i) identifying, from a first lockset of the locksets and a first sample of the samples produced for a first thread of the two or more threads, a protected access, by the first thread, to a memory location indicated by the first sample; (ii) identifying, from the first lockset and a second sample of the samples produced for a second thread of the two or more threads, an unprotected access, by the second thread, to the memory location indicated by the second sample; and (iii) determining the data race condition exists based on the identified protected access and the identified unprotected access; and selectively outputting an indication of the data race condition. - View Dependent Claims (12, 13, 14, 15)
-
Specification