Threads vs Process in OS

Jul 23, 2023

1. First look

  • Process is a running program.
  • Thread is a single sequence stream within a process (light-weight process).

Another way to think of this is that each thread is very much like a separate process, except for one difference: they share the same address space and thus can access the same data.

2. Key Differences

ProcessThread
Process means any program is in execution.Thread means a segment of a process.
Take more time to terminate/create/context switching.Take less time.
The process is isolated.Threads share memory.

3. E.g.

Imagine if a process is a chrome.exe running.

Threads can be: Handle downloading task, handle display the page, handle user’s interactions. (Multi-threads).

4. Thread vs Multi-threads

Multi-threads example

Source: Neso Academy.

Multi-threads have 4 key advantages: Responsiveness, Resource sharing, Economy (create/context switching), Utilization of multi-processor architectures.