Chapter 7. Profiling and Debugging

In this chapter, we will cover the following recipes:

  • Using the Threads and Call Stack windows
  • Using the Parallel Stacks window
  • Watching values in a thread with Parallel Watch window
  • Detecting deadlocks with the parallel tasks window
  • Measuring CPU utilization with Concurrency Visualizer
  • Using Concurrency Visualizer Threads view
  • Using Concurrency Visualizer Cores view

Introduction

Parallel programming can create complex problems. Maybe you didn't get the performance gain you expected from parallelizing your application. It could even be running slower that a sequential version of the same algorithm. Maybe you are getting consistently or occasionally incorrect results.

The problems that can occur in a parallel program are numerous and can be hard to detect. Perhaps oversubscription is causing poor performance because of the high number of context switches. Maybe you have inadvertently created a lock convoy, which is a condition that occurs when multiple threads of equal priority contend repeatedly for the same lock, and can lead to significant lock contention and serialization of the program even though multiple threads are in use.

In this chapter, we are going to take a look at the Visual Studio 2012 debugging features for multi-threaded applications, and how to use those features to solve concurrency related issues.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.0.53