zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    录音和朗诵的实现
    树型控件的处理(完整版)
    蜘蛛爬虫
    百度公司面试题
    一名程序员的杂想
    javascript语法
    HTML标签
    Winform中保存当前控件的记录
    hdu3079 Vowel Counting (strlwr(将字符串中的字母转换为小写);strupr(转换为大写))
    hdu 1860 统计字符 (水)
  • 原文地址:https://www.cnblogs.com/liangning/p/3861182.html
Copyright © 2011-2022 走看看