如何测试线程安全 [英] How to test for thread safety
问题描述
你有什么建议如何测试一个多线程应用程序
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#)
推荐答案
您可以使用一些好的工具测试数据一样的种族,死锁,失速线程等
英特尔线程中的所有线程问题-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.
You can also try, CHESS by Microsoft Research
这篇关于如何测试线程安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!