There is a tip for writing multithreaded distributed applications. For easier debugging it is very useful to design an application which
can be configured to work in a single threaded mode. This will allow you to find deadlocks more easily.
Of course if you have a full access to the system and the source codes of all related software this tip gives you no significant help
but in real life sometimes there are some constraints.
For example, imagine there are N running applications, which code you can not see and you are writing a new application.
Your application has multiple threads and all of them are connected to the database to execute some queries. The queries include SELECT, INSERT and UPDATE.
But you know that there is another running software which is also using the database to manipulate the same data.
This means there can be multiple simultaneous connections executing the same queries. Database is locking some tables or rows to perform some
operations. And now in your new application you have a deadlock related to database locking some data.
In this situation it is useful to run your application in a single threaded mode.
This will allow you to see if the problem was created by another code or the source of the problem lies in your new application.
By decreasing the number of simultaneous threads it will be clear what software is actually causes the troubles.