|
Task Type |
Description |
|---|---|
|
program |
|
|
processes |
usually starts with a single thread i.e a primary thread but later down the line of execution it can create multiple threads |
|
threads |
|
|
virtual thread |
|
|
task |
|
see how they relate to hardware concepts: Threading - Parallel - Distributed - Concurrency - Asynchronous
Program vs Process
/program-vs-process.png)
Process vs Thread vs Virtual Thread / Fiber
|
Process |
Thread | ||
|
Heavyweight/Kernel/OS Thread |
Lightweight/Virtual/User-Mode Thread - Fiber | ||
|---|---|---|---|
|
Handled By |
Operating System |
Programming Language’s Virtual Machine | |
|
Basic |
program in execution |
lightweight process or part of it | |
|
Memory sharing |
completely isolated and do not share memory |
shares memory with each other |
shares memory with each other |
|
Resource consumption |
more |
less |
lesser |
|
Time required for creation |
more |
less |
lesser |
|
Context switching time |
consumes more time |
consumes less time |
consumes lesser time |
|
Uncertain termination |
results in loss of process |
a thread can be reclaimed |
? |
|
Time required for termination |
more |
less |
lesser |