Threads run in parallel within a single process, to understand why tread is useful, you can imagine application where one thread can fetch data in the background,while another thread can display the data as it arrives.
When Treads are useful:
Multithreading is useful when one thread is waiting for response, another thread can take advantage of using CPU. For example your application have background action which need to wait for I/O response, if you don’t use thread, in this phase CPU will wait till you get response and continue.
Most of calculation can be done in parallel, if your application have lots of calculation depend on formula, you can use threads to control resources and also speed up your calculation (Take note that threads are not always speed up your calculation).
Another benefit of thread is in client-server application. Client request can be received concurrently by server and server can use thread to speed up respons to client.
Im very happy to find this web site. I want to to thank you for ones time just for this fantastic read!! I definitely appreciated every part of it and i also have you saved as a favorite to see new information in your blog.