testing concurrency runtime via a testing concurrency
play

Testing Concurrency Runtime via a Testing Concurrency Runtime via a - PowerPoint PPT Presentation

Testing Concurrency Runtime via a Testing Concurrency Runtime via a Stochastic Stress Framework Stochastic Stress Framework Atilla Gunal Technical Computing Group Microsoft Agenda Agenda The Product Concurrency Runtime The


  1. Testing Concurrency Runtime via a Testing Concurrency Runtime via a Stochastic Stress Framework Stochastic Stress Framework Atilla Gunal Technical Computing Group Microsoft

  2. Agenda Agenda  The Product ◦ Concurrency Runtime  The Problem ◦ Testing concurrent software  The Model ◦ A stochastic stress framework  The Results ◦ Bugs found ◦ Effectiveness of framework ◦ Comparison with similar tools

  3. The Product: The Product: Concurrency Runtime Concurrency Runtime

  4. Concurrency Runtime Concurrency Runtime  Runtime for parallel execution ◦ Parallel_for(1, 10, Foo )  Dynamic ◦ Composed of interacting components  Performance centric  O cean of race conditions

  5. The Problem: The Problem: Testing Concurrent Software Testing Concurrent Software

  6. Problem: State Space Explosion Problem: State Space Explosion Number of Enumeration of Interactions Number of Functionalities Interactions 1 F1 1 2 F1, F2, F1F2, F2F1 4 3 F1, F2, F3, F1F2, F1F3, … 15 … … … N F1, F2, …, FN , N + F1F2, F1F3, … N x(N -1) + F1F2F3, F1F2F4, … N x(N -1)x(N -2) + … … F1F2F3…FN , F2F1F3…FN , … N ! It’s hard to test software!

  7. Problem: Thread Interactions Problem: Thread Interactions  Interaction boundary for serial software F1 F2 Interaction boundary: A point  Interaction boundary for concurrent software Thread 1: F1 Thread 2: F2 Interaction boundary: An interval It’s even harder to test concurrent software!

  8. The Model: The Model: Stochastic Stress Framework Stochastic Stress Framework

  9. Key Abilities of the Model Key Abilities of the Model Use random distributions Combine multiple tests Randomize thread executions

  10. Ability 1: Use Random Distributions Ability 1: Use Random Distributions Feature 1 Feature 2 … Feature N F1(int) Stress Test 1 Stress Test 2 … Stress Test N F1(N 1) F1(N 2) Thread 2 Thread 1

  11. Use Random Distributions Use Random Distributions N 1, N 2 comes from a N 1, N 2 is fixed Random distribution F1 F1 F1 F1 F1 F1 Thread 1 Thread 1 F1 F1 F1 F1 Thread 2 F1 F1 Thread 2 Improves thread interactions!

  12. Ability 2: Combine Multiple Ability 2: Combine Multiple Tests Tests Feature 1 Feature 2 … Feature N F3(int) F4(int) F1(int) F2(int) Stress Test 1 Stress Test 2 … Stress Test N State Shared State State F1(N 1) F2(N 2) F3(N 1) F4(N 2) F3(N 1) F4(N 2) F1(N 1) F2(N 2) Combine Thread 4 Thread 2 Thread 3 Thread 2 Thread 2 Thread 1 Thread 1 Thread 1 Copes with state space explosion!

  13. Ability 3: Randomize Thread Ability 3: Randomize Thread Executions Executions  Reason for thread interruption  Thread blocks  Thread quantum (Q ) expires F1 F1 Thread 1 O S resumes Thread 1 later on Q expires F1 completes This part rarely gets interrupted

  14. Randomize Thread Executions Randomize Thread Executions  Pseudo code of the tool Pick a random thread Suspend that thread Sleep for some random time Resume thread Fixed Q Thread Randomization Probability distribution of Q Improves thread interactions!

  15. Summary of Problems and Abilities Summary of Problems and Abilities Problems Abilities State space explosion Combine multiple tests Interactions between threads Use random distributions Apply thread randomization

  16. The Results The Results

  17. Efficiency of The Stress Tests Efficiency of The Stress Tests Bug count Efficiency Bug finding activity Bug finding activity Number of Bugs 1000 Lines of code Found Feature Testing 282 163 Stress 88 63

  18. Effectiveness of stress tests Bugs found Stress Test …

  19. Comparison Comparison  Repetitive Functional Execution ◦ Limited Randomization ◦ Limited shared runtime state  Cuzz ◦ Smarter thread randomization tool ◦ Running stress under Cuzz – no issues found

  20. Conclusion Conclusion  Key takeaways to cope with concurrency ◦ Combine multiple tests ◦ Apply random distributions ◦ Randomize thread executions

  21. Q uestions? Q uestions?

Recommend


More recommend