Difference between process and thread.
Point 1:
A process is an executing instance of an application.
Thread is independent path of execution within a process. Process can have multiple threads,
Point 2:
Threads itself is capable enough to do all the things a process does and thread is a part of process that is why thread can be termed as light-weight process.
Point 3:
Since all the Threads are part of a same Process they all share same memory allocated by Process.
Process use memory allocated by OS.
Point 4:
Inter-thread communication between threads is easy whereas Inter-process communication is difficult.
Point 5:
Processes have independent data and code segments.
Thread shares the data segment, code segment, files etc. with its peer threads.
Point 6:
Process switching is complex as compared to thread switching because of the amount of variables need to be maintained in both of the case.
Per process items | Per thread items |
---|---|
Address space | Program counter |
Global variables | Registers |
Open files | Stack |
Child processes | State |
Pending alarms | |
Signals and signal handlers | |
Accounting information |
You may also like to see
Sort Linked list using Merge sort
Bubble Sort
Heap Sort
Selection Sort
Insertion Sort
How ConcurrentHashMap works and ConcurrentHashMap interview questions
How Much Water Can A Bar Graph with different heights can Hold
Interview Questions-Answer Bank
Enjoy !!!!
If you find any issue in post or face any error while implementing, Please comment.
No comments:
Post a Comment