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.
Source code analysis tools, also known as Static Application Security Testing (SAST) Tools, can help analyze source code or compiled versions of code to help find security flaws. SAST tools can be added into your IDE. Such tools can help you detect issues during software development.
Helix QAC is an excellent static analysis testing tool for C and C++ code from Perforce (formerly PRQA).
Static Code Analysis is a method of analyzing the source code of programs without running them. It can discover formatting problems, null pointer dereferencing, and other simple scenarios.
Codacy is a Static code analysis tool capable of identifying security issues, code duplication, coding standards violation etc. Supports 30+ programming languages. Integration with Source code tools like Github and Bitbucket. Organization and team management.
Here are a set of resources to help with concurrent programming...they are a mixture of static and runtime based tools.
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)
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.
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).
http://www.verifysoft.com/en_coverity_prevent_concurrency.html
http://www.theregister.co.uk/2012/08/22/mars_rover_software_coverity/)
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.
http://msdn.microsoft.com/en-us/library/windows/hardware/gg487428.aspx
http://blogs.msdn.com/b/mariohewardt/archive/2012/06/05/visual-studio-2012-and-windbg-integration.aspx
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.
http://stevestechspot.com/
http://blog.scriptico.com/04/debugging-with-windbg-deadlocks-in-applications/
Debugging a Deadlock with Windbg's !clrstack command
http://blogs.msdn.com/b/tess/archive/2008/02/11/hang-caused-by-gc-xml-deadlock.aspx
There is the Concurrency Visualizer in Visual Studio and an SDK to go with it.
http://msdn.microsoft.com/en-us/library/dd537632.aspx
http://blogs.msdn.com/b/visualizeparallel/archive/2011/10/17/introducing-the-concurrency-visualizer-sdk.aspx
http://msdn.microsoft.com/en-us/magazine/ee336027.aspx
http://msdn.microsoft.com/en-us/magazine/ee410778.aspx
http://msdn.microsoft.com/en-us/magazine/cc817398.aspx
http://msdn.microsoft.com/en-us/library/ff963553.aspx
http://msdn.microsoft.com/en-us/magazine/cc872852.aspx
http://msdn.microsoft.com/en-us/magazine/cc163744.aspx
http://www.packtpub.com/beginners-guide-for-C-sharp-2008-and-2005-threaded-programming/book
Here's a brilliant series of Videos that give you general advice on debugging .NET applications:
I should add:
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.
Verifying Reentrant Readers-Writers. Bernard van Gastel.
Reentrant Readers-Writers – a Case Study Combining Model Checking with Theorem Proving – ICIS Technical Report R08005. Bernard van Gastel, Leonard Lensink, Sjaak Smetsers and Marko van Eekelen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With