When an event occurs, the method designated to handled it is called. If an event has to trigger other activities, the latter have to be executed during the same call, because all methods must return before the main can get the next event. Thus the programmer must encode the behavior of the application within a network of calls and assure that whatever happens, there will be no unwanted interactions between the operations of the objects. The coding of this part of the application is more and more difficult as the application grows. A way to avoid this situation is to use multithreading.
Several threads can wait simultaneously for several kinds of events.
They can transmit messages to other threads if some work must be executed asynchronously, while the thread considered awaits the next event immediately. This is a well known technique, but surprisingly it is not broadly used. One of the main reason may be the difficulty of identifying errors in such environments. This is why modeling, analysis and testing techniques should be developed. In this approach, we use concurrency purely as a means of structuring applications.