如何测试螺纹安全性

问题描述:

您有任何建议如何测试多线程应用程序吗?

Do you have any advices how to test a multithreaded application?

我知道,线程错误很难捕获,它们可能随时发生 - 所有。测试很困难,结果从来不确定。当然,最好仔细设计和编程并发模块。

尽管如此 - 我不想遗漏测试方面。所以运行很多线程,所有工作在相同的项目可以调用线程错误,有时。

I know, threading errors are very difficult to catch and they may occur at anytime - or not at all. Tests are difficult and the results are never for sure. Certainly it is best to carefully design and program the concurrent modules.
Nevertheless - I do not want to leave out the test aspect. So running a lot of threads that are all working on the same items can invoke threading errors, sometimes.

任何想法或最佳做法获得高命中率的隐藏线程错误?

(我使用.Net / C#)

Any ideas or best practices to get a high hit rate of hidden threading errors?
(I am using .Net/C#)

测试所有的线程问题,如数据竞争,死锁,停滞的线程等。
intel-thread-checker 是一个很好的工具。

You can use some good tools to test all the threading issues like Data races, deadlocks, stalled threads etc. intel-thread-checker is one such good tool.

您还可以尝试, CHESS