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

testing concurrency runtime via a testing concurrency
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Testing Concurrency Runtime via a Testing Concurrency Runtime via a Stochastic Stress Framework Stochastic Stress Framework

Atilla Gunal

Technical Computing Group Microsoft

slide-2
SLIDE 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
slide-3
SLIDE 3

The Product: The Product: Concurrency Runtime Concurrency Runtime

slide-4
SLIDE 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

slide-5
SLIDE 5

The Problem: The Problem: Testing Concurrent Software Testing Concurrent Software

slide-6
SLIDE 6

Problem: State Space Explosion Problem: State Space Explosion

It’s hard to test software!

Number of Functionalities Enumeration of Interactions Number of Interactions

1 F1 1 2 F1, F2, F1F2, F2F1 4 3 F1, F2, F3, F1F2, F1F3, … 15 … … … N F1, F2, …, FN , F1F2, F1F3, … F1F2F3, F1F2F4, … … F1F2F3…FN , F2F1F3…FN , … N + N x(N -1) + N x(N -1)x(N -2) + … N !

slide-7
SLIDE 7

Problem: Thread Interactions Problem: Thread Interactions

It’s even harder to test concurrent software!

 Interaction boundary for serial software  Interaction boundary for concurrent software

F1 F2 Interaction boundary: A point F1 F2 Interaction boundary: An interval Thread 1: Thread 2:

slide-8
SLIDE 8

The Model: The Model: Stochastic Stress Framework Stochastic Stress Framework

slide-9
SLIDE 9

Key Abilities of the Model Key Abilities of the Model

Use random distributions Combine multiple tests Randomize thread executions

slide-10
SLIDE 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 1 Thread 2

slide-11
SLIDE 11

Use Random Distributions Use Random Distributions

N 1, N 2 is fixed N 1, N 2 comes from a Random distribution

Improves thread interactions!

F1 F1 F1 F1 F1 F1

Thread 1 Thread 2

F1 F1 F1 F1 F1 F1

Thread 1 Thread 2

slide-12
SLIDE 12

Ability 2: Combine Multiple Ability 2: Combine Multiple Tests Tests

Feature 1 Feature 2 Feature N … F1(int) F2(int) Stress Test 1 Stress Test 2 Stress Test N … F3(int) F4(int) Combine

F1(N 1) F2(N 2)

Thread 1 Thread 2

State

F3(N 1) F4(N 2)

Thread 1 Thread 2

State

F1(N 1) F2(N 2)

Thread 1 Thread 2

F3(N 1) F4(N 2)

Thread 3 Thread 4

Shared State

Copes with state space explosion!

slide-13
SLIDE 13

Ability 3: Randomize Thread Ability 3: Randomize Thread Executions Executions

 Reason for thread interruption

 Thread blocks  Thread quantum (Q ) expires

O S resumes Thread 1 later on F1 Q expires

Thread 1

F1 F1 completes This part rarely gets interrupted

slide-14
SLIDE 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

Thread Randomization Fixed Q Probability distribution of Q

Improves thread interactions!

slide-15
SLIDE 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

slide-16
SLIDE 16

The Results The Results

slide-17
SLIDE 17

Efficiency of The Stress Tests Efficiency of The Stress Tests

Bug finding activity Number of Bugs Found 1000 Lines of code Feature Testing

282 163

Stress

88 63

Bug count Bug finding activity Efficiency

slide-18
SLIDE 18

Effectiveness of stress tests

Stress Test

Bugs found

slide-19
SLIDE 19

Comparison Comparison

 Repetitive Functional Execution

  • Limited Randomization
  • Limited shared runtime state

 Cuzz

  • Smarter thread randomization tool
  • Running stress under Cuzz – no issues

found

slide-20
SLIDE 20

Conclusion Conclusion

 Key takeaways to cope with concurrency

  • Combine multiple tests
  • Apply random distributions
  • Randomize thread executions
slide-21
SLIDE 21

Q uestions? Q uestions?