# Thread control block

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Thread_control_block
> Markdown URL: https://mediated.wiki/source/Thread_control_block.md
> Source: https://en.wikipedia.org/wiki/Thread_control_block
> Source revision: 1318766561
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{More citations needed|date=September 2023}}

'''Thread Control Block''' ('''TCB''') is a [data structure](/source/data_structure) in an [operating system kernel](/source/operating_system_kernel) that contains [thread](/source/Thread_(computing))-specific information needed to manage the thread.<ref>{{Cite web |date=2019-11-26 |title=Thread Control Block in Operating System |url=https://www.geeksforgeeks.org/thread-control-block-in-operating-system/ |access-date=2023-09-04 |website=GeeksforGeeks |language=en-us}}</ref> The TCB is "the manifestation of a thread in an operating system."

Each thread has a thread control block. An operating system keeps track of the thread control blocks in kernel memory.<ref>{{Cite web |title=CS162 - Fall 2014 #7 - Kernel Threads|url=https://inst.eecs.berkeley.edu/~cs162/fa14// |access-date=2023-12-07 |website=inst.eecs.berkeley.edu|archive-url=https://web.archive.org/web/20231207231258/https://inst.eecs.berkeley.edu/~cs162/fa14//|archive-date=2023-12-07|url-status=unfit}}</ref>

An example of information contained within a TCB is:
* Thread Identifier: Unique id (tid) is assigned to every new thread
* [Stack pointer](/source/Stack_pointer): Points to thread's stack in the process
* [Program counter](/source/Program_counter): Points to the current program instruction of the thread
* State of the thread (running, ready, waiting, start, done)
* Thread's [register](/source/Processor_register) values
* Pointer to the [Process control block](/source/Process_control_block) (PCB) of the process that the thread lives on

The Thread Control Block acts as a library of information about the [threads](/source/Thread_(computing)) in a system. Specific information is stored in the thread control block highlighting important information about each process.

== See also ==
* [Parallel Thread Execution](/source/Parallel_Thread_Execution)
* [Process control block](/source/Process_control_block) (PCB)
* [Thread Environment Block](/source/Thread_Environment_Block) (TEB)
* [Thread-local storage](/source/Thread-local_storage) (TLS)

== References ==
{{Reflist}}

Category:Operating system kernels

---
Adapted from the Wikipedia article [Thread control block](https://en.wikipedia.org/wiki/Thread_control_block) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Thread_control_block?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
