- 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.
- 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.
When a process is created using fork, a new copy of the process is created with its own variables and its own PID. This new process is scheduled independently, and executes almost independently of the process that created it.
When a new thread is created in a process, the new thread of execution gets its own stack (and hence local variables) but shares global variables, file descriptors, signal handlers, and its current directory state with the process that created it.
You may like to read :
Reference : linuxjournal.com