Whenever an application runs, it runs under a main thread. However,
running a single thread can sometimes lead to unnecessary performance
and locking issues. So if the application can be broken into multiple
threads without hampering the flow of the main thread, then using it is always
better.
Figure 1

The following care needs to be taken while going for
multithreading.
While using the threads we need to be very careful about the
flow of each individual thread. Otherwise, there is a heavy probability of
deadlock creation when multithreading comes into picture.
All the sub-internal threads need to be ended before the
main thread ends.