10

I am implementing a concurrent .NET data structures in c# (like ConcurrentDictionary, BlockcingCollection etc.). It's not about just not forgetting to lock an object when accessing from different threads. It requires sophisticated locking strategies to maximize parallel execution time.

I know there is a tool, a kind of framework for systematic concurrency testing for .NET named CHESS.

Question: Is there also a tool which will find concurrency / threading issues through static code analyses? Something like CheckThread which is for java.

George Mamaladze
  • 7,593
  • 2
  • 36
  • 52
  • 4
    I have 2 "not constructive" - close votes. If one will comment please, it would help me to understand what's wrong on my question. – George Mamaladze Aug 01 '12 at 19:21
  • http://software.intel.com/en-us/articles/intel-inspector-xe/ for checking for concurrency issues at runtime... and there's a static analyser but that's for C++. – Colin Smith Aug 01 '12 at 19:32
  • Thanks @colinsmith . Why don't you add some text, information, experience you have on the tool and make an answer out of it? – George Mamaladze Aug 01 '12 at 19:35
  • Also if you're using WinDBG, and your program is getting into a deadlock situation, you can use a deadlock detector via the SOSEX plugin. http://stevestechspot.com/ .... Example use: http://blog.scriptico.com/04/debugging-with-windbg-deadlocks-in-applications/ – Colin Smith Aug 01 '12 at 19:40

2 Answers2

11

Here are a set of resources to help with concurrent programming...they are a mixture of static and runtime based tools.

Intel Inspector XE/Parallel Studio

Intel do some tools inside Parallel Studio that help with concurrent development, however their Parallel Advisor is only for C/C++.

But for C# you can do runtime thread checking with their Inspector XE (formerly Intel Thread Checker)


PRESharp (Microsoft Center for Software Excellence)

There appears to be something called PRESharp mentioned here:

Now I haven't heard of that before...only the similar sounding PREFast which I have used to statically analyse some C driver code in the past. I suspect that it's an internal Microsoft tool that no one else gets to use unless you get special access.


Static Analysis Tools

A big list of static analysis tools here (e.g. FXCop).

and Typemock Racer mentioned here:

and of note is Coverity Prevent which claims to detect concurrency defects by statically analysing C/C++, Java or C# code (rated by NASA).


WinDBG + SOSEX

Other tools to help with concurrent programming are WinDBG (part of the Windows Debugging Tools which is distributed inside the Windows SDK) which is more powerful than the Visual Studio debugger.

Note: you can now use a more powerful User Mode debugger from inside Visual Studio 2012 which has parity with WinDBG if you install the Windows Driver Kit 8 in your system.

You can also get plugins to WinDBG that extend it e.g. the SOSEX plugin adds the !dlk command which can help identify the cause of a deadlock.


Concurrency Visualizer (in Visual Studio 2010+)

There is the Concurrency Visualizer in Visual Studio and an SDK to go with it.


General Concurrent Programming Design Considerations


Video Resources

Here's a brilliant series of Videos that give you general advice on debugging .NET applications:

Community
  • 1
  • 1
Colin Smith
  • 12,375
  • 4
  • 39
  • 47
1

I should add:


Model-Based Verification

This technique uses a formal model of your application's threading primitives, and tries to assert or disprove that the model has the properties that you desire, such as freedom from deadlocks.

One writes the model in a formal language, such as Promela and then proves properties of the model using a model checker such as Spin.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313