Concurrent code analyzer

佐手、 提交于 2019-12-22 08:47:17

问题


I was wondering if there is any framework or application(app)/program out there that can analyze the concurrency of any java code?

If the tool knows all the implementations of the jre shipped classes and methods then it comes down to a simple analyzing of synchronized blocks and method and their call hierarchies. From here it can create a petri net and tell you for sure if you could ever experience a deadlock.

Am I missing out on something or is this really so easy? Then there must be some cool tool doing that kind of stuff? Or would such a tool report too many possible deadlocks that are completely save because of some underlying program/business logic? Petri nets should be powerful enough to handle these situations?

This would save so many man hours of searching for bugs that might or might not be related to dead locking issues.


回答1:


Although (many) concurrency related bugs can be found using static code analysis, it doesn't apply to every type of bug. Some bugs only appear at runtime under certain conditions.

IBM has a tool called ConTest that "schedules the execution of program threads such that program scenarios that are likely to contain race conditions, deadlocks, and other intermittent bugs (collectively called synchronization problems) are forced to appear with high frequency".

This requires running (unit)tests against an instrumented version of your app. More background info in this developerWorks article.




回答2:


This paper describes a tool that performs static analysis of a library and determines if deadlock is possible.




回答3:


Some more :

  • klocwork
  • CheckThread


来源:https://stackoverflow.com/questions/6090691/concurrent-code-analyzer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!