|
Answer» The advantages of thread over processes are as follows: - Faster thread context SWITCHING: Thread context switching is faster than process context switching. Process context shift necessitates greater CPU overhead.
- Responsiveness: If the process is separated into numerous threads, the OUTPUT of one thread can be returned promptly as it completes its execution.
- Resource sharing: WITHIN a process, resources such as code, data, and files can be shared throughout all threads. It is worth noting that the stack and registers can't be shared between threads. Each thread has its own registers and stack.
- Effective multiprocessor system utilization: If a single process has numerous threads, we can schedule several threads on multiple processors. The process will run more quickly as a result of this.
- Increased System Throughput: When a process is separated into several threads, each thread function is treated as a single TASK, the number of jobs done per unit of TIME increases, boosting the system's throughput.
- Communication: Because the threads share a similar address space, communication between them is easier. During the process, we must use a special communication approach to communicate between the two processes.
|