

Interview Question: How to check multi-threaded applications? - CraniumRat

All,<p>I was asked this by one of my friends.<p>In my experience, multi-threaded apps are usually built with a premise of fire &#38; forget (process incoming orders &#38; dump to database), or drivers. (In Windows kernel, Windows passes requests to registered callbacks, so all instances of the callback will use the same synchronization object (if needed), so race conditions do not arise.)<p>The other general answer is to use formal methods. For example, Windows provides StaticDV to check your driver for race conditions.<p>I am still unsure if the answer is complete. Thoughts?
======
ismarc
Your perception of experience is flawed. Ever user interface application is
multi-threaded. It's actually fairly rare to run across a single threaded
application anymore. Most single threaded applications are going to be daemons
(system services), and even then most are multi-threaded.

The question is ill-stated as well. "How to check multi-threaded
applications?" Do you mean "How do you debug multi-threaded applications?" or
do you mean "How do you verify multi-threaded applications?"

There's a little coverage of a Microsoft tool called CHESS that is designed to
help with unit testing of multi-threaded applications. More information at
<http://research.microsoft.com/en-us/projects/chess/> if you're looking at
Microsoft technologies. IBM has ConTest
[http://www.ibm.com/developerworks/java/library/j-contest.htm...](http://www.ibm.com/developerworks/java/library/j-contest.html).

For more information on unit testing multi-threaded applications, see
<http://goodliffe.blogspot.com/search/label/threads>.

