linux内核中与进程相关的数据结构(基于linux3.16-rc4)

1.进程描述符

 1 struct task_struct {
 2 
 3    volatile long state;
 4 
 5   .......
 6 
 7    struct list_head tasks;
 8 
 9   .......
10 
11    struct mm_struct *mm, *active_mm;
12 
13   .......
14 
15    struct vm_area_struct *vmacache[VMACACHE_SIZE];
16 
17   ......
18 
19    pid_t pid;
20    pid_t tgid;
21 
22   .......
23    }

所在文件:include/linux/sched.h

 

2.线程描述符(current指向该描述符,并通过该描述符找到进程描述符)

 1  struct thread_info {
 2          struct task_struct      *task;                             /* main task structure */
 3          struct2. exec_domain  *exec_domain;              /* execution domain */
 4          __u32                        flags;                             /* low level flags */
 5          __u32                        status;                          /* thread synchronous flags     */
 6          __u32                        cpu;                             /* current CPU */
 7          int                              saved_preempt_count;
 8          mm_segment_t         addr_limit;
 9          struct restart_block   restart_block;
10          void __user               *sysenter_return;
11          unsigned int              sig_on_uaccess_error:1;
12          unsigned int              uaccess_err:1;              /* uaccess failed */
13    };

所在文件:arch/x86/include/asm/thread_info.h

 

3.进程的内核栈

1   union thread_union {
2 
3   struct thread_info thread_info;
4 
5   unsigned long stack[THREAD_SIZE/sizeof(long)];
6 
7    }

所在文件:include/linux/sched.h

    

4.进程的运行队列

1 struct rt_prio_array {                            
2 
3    DECLARE_BITMAP(bitmap, MAX_RT_PRIO+1);
4 
5    struct list_head queue[MAX_RT_PRIO];
6 
7  }

所在文件:kernel/sched/sched.h

 

posted @ 2014-07-22 18:40  Mr.doer  阅读(452)  评论(1编辑  收藏  举报