X

Download Systematic Concurrency Testing using CHESS PowerPoint Presentation


Login   OR  Register
X

Share page



  Preview

               
Home / Sports & Recreation / Sports & Recreation Presentations / Systematic Concurrency Testing using CHESS PowerPoint Presentation

Systematic Concurrency Testing using CHESS PowerPoint Presentation

onlinesearch By : onlinesearch

On : Feb 10, 2014

In : Sports & Recreation

Embed :
601
views

0
downloads
Login / Signup - with account for


  • → Make favorite
  • → Flag as inappropriate
  • → Download Presentation
  • → Share Presentation
  • Slide 1 - CHESS: Systematic Concurrency Testing Tom Ball, Sebastian Burckhardt, Madan Musuvathi, Shaz Qadeer Microsoft Research http://research.microsoft.com/CHESS/
  • Slide 2 - Testing concurrent programs is HARD Rare thread interleavings expose bugs Coverage problem Testing misses thread interleavings that expose errors Reproducibility problem Concurrency bugs == Heisenbugs Not reproducible  hard to debug Crash dumps don’t help
  • Slide 3 - Thread interleavings x++; x++; x*=2; x*=2; 4 1 0 2 8 4 3 2 5 6 Thread 1 Thread 2 1 0 0 2 2 2 1 4 3
  • Slide 4 - Concurrency testing today Concurrency testing == stress testing Example: testing a concurrent queue Create 100 threads performing queue operations Run for days/weeks Stress increases the interleaving variety, but Not systematic: might miss interleavings Not predictable: cannot find the same error again Makes any error found hard to debug
  • Slide 5 - 1 Why stress is not sufficient
  • Slide 6 - Concurrency testing : what we need Methodology and tools to systematically and predictably test thread interleavings
  • Slide 7 - CHESS in a nutshell Replace the OS scheduler with a demonic scheduler Systematically explore all scheduling choices ConcurrentProgram Win32 API Kernel Scheduler Demonic Scheduler
  • Slide 8 - CHESS will run this program 6 times exploring all the different interleavings x++; x++; x*=2; x*=2; 4 1 0 2 8 4 3 2 5 6 Thread 1 Thread 2 1 0 0 2 2 2 1 4 3
  • Slide 9 - 2 Don’t stress, use CHESS
  • Slide 10 - CHESS architecture Kernel: Threads, Scheduler, Synchronization Objects While(not done) { TestScenario() } TestScenario() { … } Program CHESS CHESS runs the scenario in a loop Every run takes a different interleaving Every run is repeatable Win32 API Intercept synch. & threading calls To control and introduce nondeterminism Detect Assertion violations Deadlocks Dataraces Livelocks
  • Slide 11 - CHESS methodology generalizes Need wrappers for every concurrency API CHESS has wrappers for Win32, .NET, Singularity Wrappers understand the semantics of the API Expose nondeterminism in the API Looking for volunteers to build wrappers for Linux and Java
  • Slide 12 - CHESS clients PCP = Parallel Computing Platform (for multi/many-cores) PLINQ: Parallel LINQ CDS: Concurrent Data Structures STM: Software Transactional Memory TPL: Task Parallel Library ConcRT: Concurrency RunTime CCR: Concurrency Coordination Runtime Dryad Part of COSMOS Singularity/Midori CHESS can systematically test the boot and shutdown process
  • Slide 13 - Stateless model checking [Verisoft ‘97] Systematically enumerate all paths in a state-space graph Don’t capture program states Capturing states is extremely hard for large programs Effective for message-passing programs CHESS applies stateless model checking for shared-memory multithreaded programs
  • Slide 14 - Outline Preemption bounding [PLDI ‘07] Fair stateless model checking [PLDI ‘08] Sober [CAV ’08, EC2 ‘08] FeatherLite Concurrency Explorer [EC2 ‘08]
  • Slide 15 - Outline Preemption bounding Makes CHESS effective on deep state spaces Fair stateless model checking Sober FeatherLite Concurrency Explorer
  • Slide 16 - x = 1; … … … … … y = k; State space explosion Thread 1 Thread n x = 1; … … … … … y = k; … n threads k steps each Number of executions = O( nnk ) Exponential in both n and k Typically: n < 10 k > 100 Limits scalability to large programs Goal: Scale CHESS to large programs (large k)
  • Slide 17 - x = 1; if (p != 0) { x = p->f; } Preemption bounding Prioritize executions with small number of preemptions Two kinds of context switches: Preemptions – forced by the scheduler e.g. Time-slice expiration Non-preemptions – a thread voluntarily yields e.g. Blocking on an unavailable lock, thread end x = p->f; } x = 1; if (p != 0) { p = 0; Thread 1 Thread 2 preemption non-preemption
  • Slide 18 - Polynomial state space Terminating program with fixed inputs and deterministic threads n threads, k steps each, c preemptions Number of executions <= nkCc . (n+c)! = O( (n2k)c. n! ) Exponential in n and c, but not in k x = 1; … … … … … y = k; x = 1; … … … … … y = k; Thread 1 Thread 2 x = 1; … … … … x = 1; … … … … y = k; … … y = k; Choose c preemption points Permute n+c atomic blocks
  • Slide 19 - 3 Preemption bounding
  • Slide 20 - Find lots of bugs with 2 preemptions Acknowledgement: testers from PCP team
  • Slide 21 - So, is CHESS is unsound? Soundness: prove that the program is correct for a given input test harness Need to exhaustively explore all interleavings For small programs, CHESS is sound Iteratively increase the preemption bound Preemption bounding helps scale to large programs A good “knob” to trade resources for coverage Better search algorithms  more coverage faster Partial-order reduction Modular testing of loosely-coupled programs
  • Slide 22 - Outline Preemption bounding Makes CHESS effective on deep state spaces Fair stateless model checking Makes CHESS effective on cyclic state spaces Enables CHESS to find liveness violations (livelocks) Sober FeatherLite Concurrency Explorer
  • Slide 23 - Concurrent programs have cyclic state spaces Spinlocks Non-blocking algorithms Implementations of synchronization primitives Periodic timers … L1: while( ! done) { L2: Sleep(); } M1: done = 1; Thread 1 Thread 2 ! done L2 ! done L1 done L2 done L1
  • Slide 24 - A demonic scheduler unrolls any cycle ad-infinitum ! done done ! done done ! done done while( ! done) { Sleep(); } done = 1; Thread 1 Thread 2 ! done
  • Slide 25 - Depth bounding ! done done ! done done ! done done ! done Prune executions beyond a bounded number of steps Depth bound
  • Slide 26 - Problem 1: Ineffective state coverage ! done ! done ! done ! done Bound has to be large enough to reach the deepest bug Typically, greater than 100 synchronization operations Every unrolling of a cycle redundantly explores reachable state space Depth bound
  • Slide 27 - Problem 2: Cannot find livelocks Livelocks : lack of progress in a program temp = done; while( ! temp) { Sleep(); } done = 1; Thread 1 Thread 2
  • Slide 28 - Key idea This test terminates only when the scheduler is fair Fairness is assumed by programmers All cycles in correct programs are unfair A fair cycle is a livelock while( ! done) { Sleep(); } done = 1; Thread 1 Thread 2 ! done ! done done done
  • Slide 29 - We need a fair demonic scheduler Avoid unrolling unfair cycles Effective state coverage Detect fair cycles Find livelocks (violations of fair termination) ConcurrentProgram Test Harness Win32 API Demonic Scheduler Fair Demonic Scheduler
  • Slide 30 - Fair termination allows CHESS to check for arbitrary liveness properties Example: Good Samaritan assumption Forall threads t : GF scheduled(t)  GF yield(t) A thread when scheduled infinitely often yields the processor infinitely often Examples of yield: Sleep(), ScheduleThread(), asm {rep nop;} Thread completion while( ! done) { Sleep(); } done = 1; Thread 1 Thread 2
  • Slide 31 - Outline Preemption bounding Makes CHESS effective on deep state spaces Fair stateless model checking Makes CHESS effective on cyclic state spaces Enables CHESS to find liveness violations (livelocks) Sober Detect relaxed-memory model errors Do not miss behaviors only possible in a relaxed memory model FeatherLite Concurrency Explorer
  • Slide 32 - C# Example volatile bool isIdling; volatile bool hasWork; //Consumer thread void BlockOnIdle(){ lock (condVariable){ isIdling = true; if (!hasWork) Monitor.Wait(condVariable); isIdling = false; } } //Producer thread void NotifyPotentialWork(){ hasWork = true; if (isIdling) lock (condVariable) { Monitor.Pulse(condVariable); } } 32
  • Slide 33 - Key pieces of code on previous slide: On x86, hardware may perform store late Bug: Producer thread does not notice waiting Consumer, does not send signal Store ii, 1 Example: Store Buffer Vulnerability Store ii, 1 volatile int ii = 0; volatile int hw = 0; Load hw, 0 Load ii, 1 Store hw, 1 Consumer Producer 0 33
  • Slide 34 - Sober algorithm Programmers assume sequential-consistency (SC) Insert synchronizations & fences to counter memory-model relaxations Sober checks if a program is memory-model safe i.e., program has only SC executions in a memory model Reports any such violation as an error Sober is a dynamic monitor that checks if any SC execution can be extended to a non-SC execution Theorem: CHESS + Sober guarantees memory-model safety
  • Slide 35 - Outline Preemption bounding Makes CHESS effective on deep state spaces Fair stateless model checking Makes CHESS effective on cyclic state spaces Enables CHESS to find liveness violations (livelocks) Sober Detect relaxed-memory model errors Do not miss behaviors only possible in a relaxed memory model FeatherLite A light-weight data-race detection engine (<20% overhead) Concurrency Explorer
  • Slide 36 - Outline Preemption bounding Makes CHESS effective on deep state spaces Fair stateless model checking Makes CHESS effective on cyclic state spaces Enables CHESS to find liveness violations (livelocks) Sober Detect relaxed-memory model errors Do not miss behaviors only possible in a relaxed memory model FeatherLite A light-weight data-race detection engine (<20% overhead) Concurrency Explorer First-class concurrency debugging
  • Slide 37 - Conclusion Don’t stress, use CHESS CHESS binary and papers available at http://research.microsoft.com/CHESS Stateless model checking is very effective Preemption bounding to scale to deep state spaces Fair demonic scheduler to handle nonterminating programs Need better testing and debugging methodologies for concurrent programs
  • Slide 38 - Questions

Description : Available Systematic Concurrency Testing using CHESS powerpoint presentation for free download which is uploaded by search an active user in belonging ppt presentation Sports & Recreation category.

Tags : Systematic Concurrency Testing using CHESS

Shortcode : Get Shareable link