- About Process & Thread of Operating System -
A process is a program in execution. It is the unit of work in a modern operating system. A process is an active entity with a program counter specifying the next instructions to execute and a set of associated resources. It also includes the process stack, containing temporary data and a data section containing global variables.
A thread otherwise called a lightweight process (LWP) is a basic unit of CPU utilization, it comprises of a thread id, a program counter, a register set and a stack. It shares with other threads belonging to the same process its code section, data section, and operating system resources such as open files and signals.
Thread:
- Thread can do anything a process can do.
- Thread could be considered a ‘lightweight’ process.
- Threads are used for small tasks.
- Threads share the address of the process.
- Threads have direct access to the data segment of the process.
Process:
- Process consists of single/multiple threads.
- Processes are used for more ‘heavyweight’ tasks, basically the execution of applications.
- Processes have own data and the data segment of the parent process.
- Processes have their own address.
- Processes have considerable overhead.
Lets try this to understand with an example. Children are playing with lego toys, they are planing to make an beautiful architecture. Through a process they can build it.
And the thread is one of the kids are making one of the parts of the architecture. Here each kid is a thread of the process. Each kid's/thread's objective is to do a particular task to complete the architecture/process.
Thanks to,
http://www.differencebetween.net/ | http://www.slideshare.net/ | http://www.wikipedia.org/