US2015261654A1PendingUtilityA1

Data collisions in concurrent programs

Assignee: MICROSOFT TECHNOLOGY LICENSING LLCPriority: Jun 18, 2010Filed: May 29, 2015Published: Sep 17, 2015
Est. expiryJun 18, 2030(~3.9 yrs left)· nominal 20-yr term from priority
G06F 11/3644G06F 11/3632G06F 11/3636G06F 11/366
45
PatentIndex Score
0
Cited by
0
References
0
Claims

Abstract

Described are techniques for detecting data collisions between a first portion and a second portion of an application executing on a computer, the first portion and the second portions executing concurrently with respect to each other. While the first portion and second portion are executing, before the first portion accesses a memory location shared by the first portion and the second portion, a value stored in the memory location is captured and the first portion is delayed. While the second portion continues to execute the first portion is delayed. After a period of the first portion having been paused or slowed, the current content of the memory location is compared with the captured content to determine if there is a data collision. The first and second portions may be threads, and the capturing, delaying, and determining may be performed by code inserted to the application after it has been compiled.

Claims

exact text as granted — not AI-modified
1 . A method of testing for potential data collisions between a first thread and a second thread of an application executing on a computer, the first thread and the second thread configured to execute concurrently with respect to each other, the method comprising:
 automatically identifying a variable as a test target by determining that the variable is accessed by the first thread and by determining that the same variable is also accessed by the second thread;   based on the variable having been identified as a test target, automatically inserting delaying code and comparing code into the application, the delaying and comparing code inserted within application code of the first thread and at an access operation within application code of the first thread that accesses the variable, the delaying and comparing code located according to the location of the access operation within the application code of the first thread;   while the first thread and second thread are executing, before the access operation accesses the identified variable shared by the first thread and the second thread, capturing, by the comparing code, a value stored in the variable, and delaying, by the delaying code, the first thread, wherein the second thread continues to execute while the first thread is delayed; and   after a period of the first thread having been paused or slowed, comparing, by the comparing code, a current content of the variable with the captured content, and taking a debugging action in response to a determination that the current content and the captured content differ.   
     
     
         2 . A method according to  claim 1 , wherein the debugging action comprises storing an indication corresponding to the determination that the current content and the captured content differ. 
     
     
         3 . A method according to  claim 1 , wherein the first thread and the second thread comprise respective execution threads. 
     
     
         4 . A method according to  claim 1 , wherein the second thread updates the variable with new content after the capturing such that the current content differs from the captured content. 
     
     
         5 . A method according to  claim 1 , further comprising setting a debug register to trigger when the variable is accessed, and unsetting the debug register after such trigger. 
     
     
         6 . A method according to  claim 1 , wherein the comparing code executes as part of the first thread without exiting the first thread. 
     
     
         7 . A method according to  claim 6 , wherein the comparing code determines if the variable has changed during a period of delay caused by the delaying code. 
     
     
         8 . Storage hardware storing information to enable a computer to perform a process, the process comprising:
 automatically inserting test code into native code of a thread at an access operation of a program by identifying a location of the access operation in the thread, the access operation accessing a shared memory location; and   executing the application, the application comprising the native code and the test code, wherein when the test code executes the test code: captures a value from the shared memory location, then induces a delay of the thread of the application, and then determines whether the captured value is equal to content read from the shared memory location after the delay.   
     
     
         9 . Storage hardware according to  claim 8 , wherein during the access operation comprises a read operation that reads the shared memory location. 
     
     
         10 . Storage hardware according to  claim 9 , wherein another thread of the application is executing concurrently during the induced delay, and wherein the other thread updates the content of the shared memory location during the induced delay and the test code detects the update. 
     
     
         11 . Storage hardware according to  claim 8 , wherein the native code and the test code comprise binary processor instructions. 
     
     
         12 . Storage hardware according to  claim 8 , wherein the test code does not cause an exit from the thread. 
     
     
         13 . Storage hardware according to  claim 12 , wherein multiple shared memory locations are tested for updates that occurred during the induced delay. 
     
     
         14 . Storage hardware according to  claim 8 , wherein the determining determines that the captured value and the content are not equal and in response a message is sent to an interactive debugger. 
     
     
         15 . A method of detecting a data collision over data shared by concurrently executing first and second threads of an application, the first thread and the second thread both having code that accesses shared memory units, the method comprising:
 automatically locating access operations of the first thread that access the shared memory units, and in response automatically inserting test code portions into the first thread at the respective identified access operations of the shared memory units;   executing the first thread, including executing the test code portions, each the test code portion, when executed in the first thread, inducing a pause or slow-down of the first thread and also checking whether content of a corresponding shared memory unit has changed; and   when determined by a test code portion that a corresponding shared memory unit's content changed, initiating a debugging or testing action by a corresponding test code portion.   
     
     
         16 . A method according to  claim 15 , wherein the debugging or testing action comprises storing information identifying the shared memory unit. 
     
     
         17 . A method according to  claim 16 , wherein a test code portion is inserted according to an annotation of corresponding source code. 
     
     
         18 . A method according to  claim 15 , wherein a symbol table is used to locate the access operations. 
     
     
         19 . A method according to  claim 15 , wherein the pause or slow-down is induced by at least one of a sleep operation, a prioritization operation, or by executing another thread. 
     
     
         20 . A method according to  claim 15 , wherein the debugging action comprises capturing context information that comprises a thread identifier, a register, a stack snapshot, or contents of a shared memory including a content captured before a pause or delay and a content after the pause or delay.

Join the waitlist — get patent alerts

Track US2015261654A1 — get alerts on status changes and closely related new filings.

We store only your email — no account needed. See our privacy policy.