Thread

From Rice Wiki
Revision as of 19:17, 7 October 2024 by Rice (talk | contribs)
Credits to OSTEP textbook

A thread in Computer Science is defined as a sequence of executing instructions from a program. Notably, it is active/running. It is different from a process in that multiple threads can share an address space.

The state of a thread consists of the Program Counter and the set of register values.

A thread control block (TCB) stores the states of threads to enable switching between them.

Each thread will also have its own stack, which is thus called thread-local storage. The address space diagram shows that not all stacks can grow indefinitely and may run into problems if there are lots of recursion.