Linux Kernel:thread_info与进程调度

环境:

Kernel Version:Linux-5.10

ARCH:ARM64

在内核中task_struct用来描述进程的通用数据,而针对不同架构的数据则存储在thread_infoLinux4.4之前thread_info独立于task_struct,并且可以通过其成员*task查找到task_struct,之后则根据宏CONFIG_THREAD_INFO_IN_TASK,CONFIG_ARCH_TASK_STRUCT_ON_STACK的值选择性存储。​​​​​

  • Linux4.4之前:thread_info独立于task_struct
struct task_struct {
	volatile long state;	/* -1 unrunnable, 0 runnable, >0 stopped */
	void *stack;
	atomic_t usage;
    ... ...
}

union thread_union {
	struct thread_info thread_info;
	unsigned long stack[THREAD_SIZE/sizeof(long)];
};

    你可能感兴趣的:(Linux,Kernel,linux)