Difference between Thread and Process

Creating a new thread is very similar to forking a new process, but there are differences.
When a new process is forked, it shares relatively little data with the parent process which created it; when a new thread is created, it shares much more information (such as all the global variables and static local variables, the open files, and the process ID).
The overhead of creating separate copies of everything makes the creation of a new process slower than the creation of a new thread. And the time it takes to pass control from one process to another (a context switch) is longer than the time required to pass control from one thread to another.

READ  How to find and kill zombie process ?

Also, since the threads share their data space, passing information from one thread to another is much more straightforward than passing information from one process to another—while this does have its own problems, it need not be difficult if a little care is taken.

Reference : linuxjournal.com

Leave a Reply

Your email address will not be published. Required fields are marked *