Rahul Patil: Complexities of Testing Concurrency

Play Rahul Patil: Complexities of Testing Concurrency
Sign in to queue


You've been hearing a lot lately about parallelism and concurrency here on Channel 9 and the fact that before you know, you'll be writing highly concurrent code due to the advent of multi-core and the soon-to-be many-core (greater than eight cores) processors. It's hard if not impossible to express parallelism using mainstream general purpose programming tools (most developers compose their applications in a sequential and imperative manner). Microsoft, along with the rest of the software tools industry, is making great strides to simply the expression of concurrency using the tools that you've grown comfortable using and rely on day to day.

Of course, the current state of tools/technology (Parallel Extensions for .NET, the Concurrency Runtime, etc) make it much easier to compose parallel tasks and move you away from programming threads explicitly. This is a huge step in the right direction, but it is only a step and much more "walking" has to be done to get us to where we need to go...

Rahul Patil is a concurrency testing expert. His is the complex lifestyle of chasing down bugs that are caused by concurrently executing code (threads). In this discussion, Rahul explains to us what the common patterns are that lead to concurreny bugs (race conditions, deadlocks, etc) and offers advice on how to catch bugs before you create them...




Right click to download this episode

The Discussion

  • User profile image
    Maybe I'm showing my age here, but didn't everyone learn this stuff in college?
  • User profile image

    Well, sure, if you majored in CS... Point is, not all developers out there think about threads in this context. There's nothing wrong with hammering home the basics. Rahul shows the pitfalls of testing concurrency and expresses the need for developers to think about concurrent design semantics. Certainly, most developers understand what a race condition is or what causes a deadlock. But how many general purpose developers out there express concurrency correctly and know how to test their code properly (this includes up front design, the use of static analysis tools and runtime testing)?


  • User profile image
    I fully agree with "revisiting the basics" in this context.

    Hey charles, I regenerated my channel 9 password which was sent to my email. I used it to sign in. Now i want to change it, but the my profile page (the link to which was sent to my email ) doesnt have anything remotely related to the password thing. 
  • User profile image

    I'm not sure what happened to customized password creation. I'll ask the dev team.
  • User profile image

    spivonious is right, this was all basics - nothing new here, really.

    If a developer does not know about locks/deadlocks etc. then I'm sorry to say, but he/she is just a poor developer. This is first year's knowledge on any decent university, no major degree required. This story was good maybe for Channel8, not 9.

    I can't say for all the niners, but I personally feel that we should focus on specialized tools that assist in debugging concurrent programs, rather than stating the obvious about problems in parallel programming.

  • User profile image

    Thanks for the feedback... How many of you use the tools addressed in this interview (from MSR as well as in the Windows SDK)? Do you want to learn more about them? Remember that Channel 9 is not just focused on the technology but also the people who make it. Rahul is tasked with building tests for concurency. Perhaps I should have focused more on what he does, exactly. That said, I still think this is useful information and is pertinent to even the most seasoned developer: code pattern correctness, tools for testing at compile time and run time. I'll look into getting some interviews set up where we dig into the tooling.

    Keep on watching,


  • User profile image
    Ralph Trickey
    Charles, great shows. Keep up the good work. Yes, I did learn about this stuff in College, but that was too many years ago and everything since then has been single threaded. I know in theory how to write code that is thread-safe, but... One thing that ,he mentioned that I think you missed is that while you've been covering the new work that's being done to take tasks and partition them over an unknown number of CPUs/Threads. That's fascinating and important stuff, but is only half the problem.

    The other part, is locks. How are they going to work in the brave new world? Are we OK with just using 'locks' for everything, or is that going to be too heavy a performance hit? When you add in multiple CPUs (including GPGPUs, and caching, etc. does this make locks too expensive? Are we going to be set up with needing to either take the performance hit of more comprehensive locks, or even knowing which type of lock needs to be held when? Are the Static analysis tools enough to guarantee that locks are acquired and released int eh same order,  or do we need new constructs to deal with these issues in the many-core world. I suspect that lock are a much bigger part of the problem/solution that I haven't really see talked about.

    Functional programming uses immutable objects and avoids the problem, but what are the rest of us supposed to do?
  • User profile image
    This was not bad. Too much of the presentation time was spend on basics. I guess a quick synopsis and pointers to other videos may have worked well. I would have loved to hear more about chess and Phoenix details.
  • User profile image
    its too basic and no great information comes from it . its sort of a drag rather
  • User profile image

    I liked the presentation.  There really isn't much treatment out there of best practices for concurrency testing.


    Functional programming will eliminate some sources of concurrency errors if there isn't shared mutable state.  However, you'll still have plenty of ordering violations in message passing.  Any time you need to gather the results of multiple computations you're going to have concurrency errors of some form or another.


    Check out Jinx, PetraVM's offering that helps deal with these problems.  It's a tool that forces concurrency errors in parallel software to occur quickly.  It's pretty complementary to most of the technologies and approaches detailed in this presentation.




Add Your 2 Cents