# Deadlocks Detection in Multithreaded Applications Based on Source Code Analysis
## 9 Conclusions  
This article describes four scenarios in which a resource conflict causes the deadlock phenomenon, and a sufficient condition is presented, the fulfilment of which results in the deadlock phenomenon. Our contribution in this field is the the method which allow to detect described scenarios by using multithreaded application source code model. Then, the RCD application was developed, which allows one to locate a single resource conflict in the leading example, which was the AP1 application. The results of the experiment show that the analysis of the source code turned out to be much faster than the complete review based on testing the selected code. This is due to the fact that the complete review repeatedly performed the algorithm, in contrast to the algorithm used in RCD, which performs much less such review operations. It is worth noting, however, that this review would only theoretically be carried out by the DD tool. There is a chance that the data used to test the application would not have values that could cause a deadlock phenomenon, but there is also a chance that a complete review should not be performed to find a deadlock. The RCD application described in this article is not yet complete, and its fast operation time results from the use of a simplified source code model of a multithreaded application, as well as locating only one type of resource conflicts causing a deadlock. However, there are indications that this tool will be more efficient than tools based on the process of testing the source code. The use of AST should be considered in further work on the RCD. The author of the work [25] uses AST in the method of automated source code refactoring. His method is based on finding specific patterns in AST for code written in Java and C ++ and then correcting that code. It is, therefore, possible that the use of AST, although introducing some redundancy, will allow one to implement a method that uses the source code model of a multithreaded application for compilers or IDE to detect phenomena such as deadlocks automatically. Unfortunately, the algorithm used in RCD also showed a \"false-positive error\", which indicates its imperfection. The popularity and multitude of ready-made code conversion tools also induce some bias in favour of AST. Currently, large-scale research on locating undesirable phenomena in multithreaded applications is not conducted due to the high level of complexity of the issues, or research is limited to object-oriented languages, with Java as the most often chosen. This is because Java as a language is limited to only one programming paradigm, and there is no revolution in it, as is the case in C++. As a result, analysis of Java code is much simpler than other languages, such as C. Additionally, the analysis of Java binary files (as well as other languages whose binary files are run on virtual machines) is very simple, because the resulting file is not affected by the environment in which file is being built or the environment in which the file will be run. As a result, the analysis of a running application is simplified compared to applications written in C, which can be compiled with many different compilers for many different operating systems, which of course, results in many different binary files. Further research work should also take into account the technique described in the published patent regarding a solution that guarantees the location of resource conflicts, causing deadlock [28]. This patent contains information about a hybrid method of locating resource conflicts causing the deadlock phenomenon. The combination of static code analysis and dynamic technique that tracks application threads made the development of an efficient and universal method possible. By analysing the source code, a set of potential conflicts in the code is created that can lead to a deadlock. Then, using the application tracking technique, these conflicts are verified. This approach, according to the creators, guarantees a negligible number of \"false-positive error\" reports.