Home > Mobile >  Can we say that a thread is a process?
Can we say that a thread is a process?

Time:09-29

Can we say that any individual thread (which is defined as an instance of a process) is a process itself?

CodePudding user response:

Can we say that any individual thread (which is defined as an instance of a process) is a process itself?

No. Threads and processes are fundamentally different things. A "thread" is a context of execution which takes a sequence of computational steps. A "process" is a container that typically consists of things like a view of memory, file descriptors, and so on and can contain one or more threads.

These concepts sometimes get confused because many systems in the past had a one-to-one correspondence between threads and processes, that is, each process had exactly one thread. As a result, they called the thing that got scheduled for execution a "process".

Later, when support for processes with more than one thread was added, that meant creating more than one thing that gets scheduled for execution, and those were called "processes". This has mostly been cleaned up, but you will still seem systems, code, and papers from that era that do not quite align with modern usage because of these kinds of transitions.

  • Related