IP Library Granted Patent US 7,926,035
Granted Patent B2
US 7,926,035 · App. 11/739,427 · Granted Apr 12, 2011

Testing multi-thread software using prioritized context switch limits

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,926,035
App. No.
11/739,427
Granted
Apr 12, 2011
Kind
B2
Abstract

Testing multithreaded application programs for errors can be carried out in an efficient and productive manner at least in part by prioritizing thread schedules based on numbers of context switches between threads therein. In particular, each thread schedule in a multithreaded application program can be prioritized based on whether a given thread schedule has the same as or less than some maximum value. A model checker module can then iteratively execute thread schedules that fit within a given context switch maximum value, or a progressively higher value up to some limit. In one implementation, for example, the model checker module executes all thread schedules that have zero preempting context switches, then all thread schedules that have only one preempting context switch, etc. Most errors in an application program can be identified by executing only those thread schedule with relatively few preempting context switches.

Claims (42)

1. A method, performed by a computer system, for testing a multi-threaded computer program, the method comprising:

receiving a context-switch bound (csb) that specifies a number of preempting context switches;

repeatedly executing the computer program in a multi-threading environment from an initial state to reach all possible states of execution of the computer program that are reachable from the initial state with at most csb preempting context switches;

for each state that is reachable from the initial state with the number of preempting context switches specified by the csb, storing the state and ceasing the corresponding execution of the computer program;

after repeatedly executing the computer program from the initial state to reach all possible states that are reachable from the initial state with at most csb preempting context switches, repeatedly executing the computer program from each stored state to reach all possible states of execution of the computer program that are reachable from each stored state with at most csb preempting context switches; and

for any error detected during the repeated execution of the computer program, notifying a user of the error.

2. The method of claim 1 , wherein each thread of the computer program is organized in a work item that also includes a state from which execution of the work item will commence.

3. The method of claim 2 , further comprising:

adding the work item for each thread that is enabled from the initial state to a first queue.

4. The method of claim 3 , wherein repeatedly executing the computer program from the initial state comprises executing each work item stored in the first queue.

5. The method of claim 4 , further comprising:

determining during execution of a first work item that the state reached was already reached by a different work item; and

canceling the execution of the first work item.

6. The method of claim 2 , further comprising:

determining during execution of each work item that the number of preempting context switches that have occurred during execution of the work item equals csb, and storing the work item in a second queue including the state of execution of the work item at the time of the last preempting context switch.

7. The method of claim 6 , wherein the first and second queues are the same.

8. The method of claim 1 , wherein notifying a user of the error comprises identifying whether the error occurred during repeated execution from the initial or the stored state.

9. One or more computer storage media storing computer executable instructions which when executed by a process perform a method for testing a multi-threaded computer program, the method comprising:

receiving a context-switch bound (csb) that specifies a number of preempting context switches;

repeatedly executing the computer program in a multi-threading environment from an initial state to reach all possible states of execution of the computer program that are reachable from the initial state with at most csb preempting context switches;

for each state that is reachable from the initial state with the number of preempting context switches specified by the csb, storing the state and ceasing the corresponding execution of the computer program;

after repeatedly executing the computer program from the initial state to reach all possible states that are reachable from the initial state with at most csb preempting context switches, repeatedly executing the computer program from each stored state to reach all possible states of execution of the computer program that are reachable from each stored state with at most csb preempting context switches; and

for any error detected during the repeated execution of the computer program, notifying a user of the error.

10. The computer storage media of claim 9 , wherein each thread of the computer program is organized in a work item that also includes a state from which execution of the work item will commence.

11. The computer storage media of claim 10 , further comprising:

adding the work item for each thread that is enabled from the initial state to a first queue.

12. The computer storage media of claim 11 , wherein repeatedly executing the computer program from the initial state comprises executing each work item stored in the first queue.

13. The computer storage media of claim 12 , further comprising:

determining during execution of a first work item that the state reached was already reached by a different work item; and

canceling the execution of the first work item.

14. The computer storage media of claim 10 , further comprising:

determining during execution of each work item that the number of preempting context switches that have occurred during execution of the work item equals csb, and storing the work item in a second queue including the state of execution of the work item at the time of the last preempting context switch.

15. The computer storage media of claim 14 , wherein the first and second queues are the same.

16. The computer storage media of claim 9 , wherein notifying a user of the error comprises identifying whether the error occurred during repeated execution from the initial or the stored state.

17. A system comprising:

a process; and

memory storing computer executable instructions which when executed by the process perform a method for testing a multi-threaded computer program, the method comprising:

receiving a context-switch bound (csb) that specifies a number of preempting context switches;

repeatedly executing the computer program in a multi-threading environment from an initial state to reach all possible states of execution of the computer program that are reachable from the initial state with at most csb preempting context switches;

for each state that is reachable from the initial state with the number of preempting context switches specified by the csb, storing the state and ceasing the corresponding execution of the computer program;

after repeatedly executing the computer program from the initial state to reach all possible states that are reachable from the initial state with at most csb preempting context switches, repeatedly executing the computer program from each stored state to reach all possible states of execution of the computer program that are reachable from each stored state with at most csb preempting context switches; and

for any error detected during the repeated execution of the computer program, notifying a user of the error.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 9, 2014
From: MICROSOFT CORPORATION
To: MICROSOFT TECHNOLOGY LICENSING, LLC
Reel/Frame 034542/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 24, 2007
From: MUSUVATHI, MADANLAL S.; QADEER, SHAZ
To: MICROSOFT CORPORATION
Reel/Frame 019203/0588 →