multithreading - Process is a thread or thread is a process? -
i asked interview question. replied thread process after thinking process superset of thread interviewer didn't agree it. confusing , i'm not able find clear answer this.
a process executing instance of application.
a thread path of execution within process. also, a process can contain multiple threads
.
1.
it’s important note thread can process can do. since process can consist of multiple threads, thread considered ‘lightweight’ process. thus, essential difference between thread , process work each 1 used accomplish. threads used small tasks, whereas processes used more ‘heavyweight’ tasks – execution of applications.
2.
another difference between thread , process threads within same process share same address space, whereas different processes not. allows threads read , write same data structures , variables, , facilitates communication between threads. communication between processes – known ipc, or inter-process communication – quite difficult , resource-intensive.
Comments
Post a Comment