Program - Process - Threads - Heavyweight/Kernel/OS/Lightweight/Virtual/User-Mode Threads / Fibers - Task (Software)

Task Type

Description

program

processes

  • is a program loaded into memory (i.e. in execution)
  • processes are independent sequences of execution
  • a process is an execution of a program
  • processes run on separate memory spaces

usually starts with a single thread i.e a primary thread but later down the line of execution it can create multiple threads

threads

  • threads are independent sequences of execution
  • a thread is an execution of a program driven by the environment of a process
  • threads run in the same memory space of its parent process

virtual thread
fiber

  • a thread is managed and scheduled by the operating system, while a virtual thread is managed and scheduled by a virtual machine

task

  • either a process or thread or virtual-thread

see how they relate to hardware concepts: Threading - Parallel - Distributed - Concurrency - Asynchronous

Program vs Process

Process vs Thread vs Virtual Thread / Fiber

Process

Thread

Heavyweight/Kernel/OS Thread

Lightweight/Virtual/User-Mode Thread - Fiber

Handled By

Operating System

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