Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a Static Code Analysis Tool For Concurrency in .NET like CheckThread for java [closed]

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.

like image 219
George Mamaladze Avatar asked Aug 01 '12 19:08

George Mamaladze


People also ask

Which tool is used for static code analysis?

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.

Which of the following is a type of C C++ static code analysis tool?

Helix QAC is an excellent static analysis testing tool for C and C++ code from Perforce (formerly PRQA).

What is static code analysis tools Java?

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.

Which tool is best suited for use by developers and provide static analysis on their code?

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.


2 Answers

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)

  • http://software.intel.com/en-us/articles/intel-inspector-xe/.

PRESharp (Microsoft Center for Software Excellence)

There appears to be something called PRESharp mentioned here:

  • http://www.microsoft.com/windows/cse/pa_projects.mspx

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).

  • What static analysis tools are available for C#?

and Typemock Racer mentioned here:

  • C#/.NET analysis tool to find race conditions/deadlocks

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/)


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.

  • http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx

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


Concurrency Visualizer (in Visual Studio 2010+)

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


General Concurrent Programming Design Considerations

  • 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


Video Resources

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

  • http://channel9.msdn.com/Series/-NET-Debugging-Stater-Kit-for-the-Production-Environment/Diagnosing-Application-Issues-01
like image 130
CSmith Avatar answered Oct 29 '22 18:10

CSmith


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.

  • 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.

like image 34
Kuba hasn't forgotten Monica Avatar answered Oct 29 '22 20:10

Kuba hasn't forgotten Monica