Thread control block
1、在context switch的时候,存放thread state data,比如各种register
wikipedia Thread control block
Thread Control Block (TCB) is a data structure in the operating system kernel which contains thread-specific information needed to manage it. The TCB is "the manifestation of a thread in an operating system."
An example of information contained within a TCB is:
1、Thread Identifier: Unique id (tid) is assigned to every new thread
2、Stack pointer: Points to thread's stack in the process
NOTE: 显然,为了支持multi thread,就需要让每个thread有一个自己的call stack
3、Program counter: Points to the current program instruction of the thread
4、State of the thread (running, ready, waiting, start, done)
5、Thread's register values
6、Pointer to the 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 in a system. Specific information is stored in the thread control block highlighting important information about each process.