1.进程描述符
struct task_struct {
volatile long state;
.......
struct list_head tasks;
.......
struct mm_struct *mm, *active_mm;
.......
struct vm_area_struct *vmacache[VMACACHE_SIZE];
......
pid_t pid;
pid_t tgid;
.......
}
所在文件:include/linux/sched.h
2.线程描述符(current指向该描述符,并通过该描述符找到进程描述符)
struct thread_info {
struct task_struct *task; /* main task structure */
struct2. exec_domain *exec_domain; /* execution domain */
__u32 flags; /* low level flags */
__u32 status; /* thread synchronous flags */
__u32 cpu; /* current CPU */
int saved_preempt_count;
mm_segment_t addr_limit;
struct restart_block restart_block;
void __user *sysenter_return;
unsigned int sig_on_uaccess_error:1;
unsigned int uaccess_err:1; /* uaccess failed */
};
所在文件:arch/x86/include/asm/thread_info.h
3.进程的内核栈
union thread_union {
struct thread_info thread_info;
unsigned long stack[THREAD_SIZE/sizeof(long)];
}
所在文件:include/linux/sched.h
4.进程的运行队列
struct rt_prio_array {
DECLARE_BITMAP(bitmap, MAX_RT_PRIO+1);
struct list_head queue[MAX_RT_PRIO];
}
所在文件:kernel/sched/sched.h
linux内核中与进程相关的数据结构(基于linux-mainline-rc4)