Comparison between Process and Thread
Difference between Process and Thread in Tabular Form
|Process is also called heavyweight process.||Thread is also called a lightweight process|
|Operating system interface is required for process switching.||Operating system is not required for thread switching.|
|Each process operates independently of the other process.||One thread can read, write or even completely clean the stack of another thread.|
|In multiple processing, each process executes the same code but has its own memory and file resources.||All threads can share the same set of open files and child process.|
|More Time required for creation.||Less Time required for creation.|
|System calls involved in process.||No system calls involved.|
|If one server process is blocked then other server processes cannot execute until the first process is unblocked.||If one thread is blocked and waiting then second thread in the same task can run.|
|Uses more resources.||Uses fewer resources.|
- Thread is a dispatchable unit of work. It consists of , program counter, a stack is also called a Light Weight Process(LWP). Because they take fewer resources than a process. A thread is Mask easy to create and destroy.
- It shares many attributes of a process. Threads are scheduled on a processor. Each thread can execute a set of instructions independent of other threads and processes. Image shows a thread.
- Every program has at least one thread. Programs without multithreading execute sequentially. That is, after executing one instruction the next instruction in sequence is executed.
- Thread is a basic processing unit to which an operating system allocates processor time and more than one thread can be executing code inside a process.
- When the user doubles click on the icon by using a mouse, the operating system creates a process and that process has one thread that runs the icon’s code.
- Each thread belongs to exactly one process and no thread can exist outside a process. Each thread represents a separate flow of control.
- When a process starts up a remote TCP connection, its thread handles the low-level details of sending out network packets.
- In Remote Procedure Call (RPC), servers are multithreaded. The server receives the messages using a separate! thread.
- Different operating system uses threads in different ways.
- Free memory is managed by kernel thread in LINUX OS.
- Solaries uses a kernel thread for interrupt handling.
- Context switching time is minimized.
- Thread support for efficient communication.
- Resource sharing is possible using threads.
- It is more economical to create and context switch threads.
- Difference Between Monolithic Kernel and Microkernel
- Difference Between Hard and Soft Real-Time System
- Difference Between Paging and Segmentation
- Difference Between Program and Process