A number of advantages come from multithreading, which is why it is a very popular option for a lot of developers:
- When a process spawns new threads, the heavy lifting has already been done by the process. The new threads don't require copying an entire program like a forked program and the memory requirements are low, so there is little performance overhead. If you look at Task Manager or view threads in Linux, you'll see hundreds or possibly thousands of threads being used, yet your system is still responsive.
- Programming threads is relatively easy compared to dealing with actual processes.
- Threads have a shared memory space they can use, controlled by the parent process. This memory space is how threads can communicate with ...