process & threads:
Program under execution is known as process. Thread is a
functionality which is executed with the other part of the program based on the
concept of "one with other" so thread is a part of process. The
implementation of threads and process differs from one operating system to
another.
Processes and threads are
independent sequences of execution. The typical difference is that threads (of
the same process) run in a shared memory space, while processes run in separate
memory spaces.
The
major difference between threads and processes is :
1. Threads share
the address space of the process that created it; processes have their own
address.
2. Threads have
direct access to the data segment of its process; processes have their own copy
of the data segment of the parent process.
3. Threads can
directly communicate with other threads of its process; processes must use interprocess
communication to communicate with sibling processes.
4. Threads have almost no overhead; processes have considerable overhead.
5. New threads are easily created; new processes require duplication of the parent process.
6. Threads can exercise considerable control over threads of the same process; processes can only exercise control over child processes.
8. Process is a program in execution where as thread is a seperate path of execution in a program.
Simillarities between process & threads.1. Share cpu.2. Sequential execution3. If one thread is blocked then the nextwill be start to run like process.