One of the most popular approaches to dealing with the complexity discussed previously is the actor approach to concurrent programming. If you look at the preceding examples in detail, you will notice one thing about them, that is, global reasoning. Whenever we have several threads that need to communicate in one with another, we are forced to reason about them together. So, we cannot take one thread and reason about it independently from other threads.
As we saw previously, the solution to the deadlock problem was to change the order in which the monitors were taken in the second thread so that the order matched the one in the first thread. Basically, when we are working in the scope of the second thread, we are forced to take into account the operations done in the first thread.
Global reasoning produces mental load...