Firstly, recall that the task structure is essentially the 'root' data structure of the process or thread – it holds all attributes of the task (as we saw earlier). Thus, it's rather large; the powerful crash(8) utility (used to analyze Linux crash dump data or investigate a live system) reports its size on x86_64 to be 9,088 bytes, as does the sizeof operator.
The task structure is defined in the include/linux/sched.h kernel header (it's a rather key header). In the following code, we show its definition with the caveat that we display only a few of its many members. (Also, the annotations in << angle brackets like this >> are used to very briefly explain the member(s)):
// include/linux/sched.h
struct task_struct {
#ifdef CONFIG_THREAD_INFO_IN_TASK
/*
* For reasons of header soup (see current_thread_info()), this
* must be the first element of task_struct.
*/
struct thread_info...