• linux内核学习之进程管理------task_struct结构体


    1.     struct task_struct {  
    2.     volatile long state;    /* -1 unrunnable, 0 runnable, >0 stopped */  
    3.     struct thread_info *thread_info;  
    4.     atomic_t usage;  
    5.     unsigned long flags;    /* per process flags, defined below */  
    6.     unsigned long ptrace;  
    7.   
    8.     int lock_depth;     /* Lock depth */  
    9.   
    10.     int prio, static_prio;  
    11.     struct list_head run_list;  
    12.     prio_array_t *array;  
    13.   
    14.     unsigned long sleep_avg;  
    15.     long interactive_credit;  
    16.     unsigned long long timestamp;  
    17.     int activated;  
    18.   
    19.     unsigned long policy;  
    20.     cpumask_t cpus_allowed;  
    21.     unsigned int time_slice, first_time_slice;  
    22.   
    23.     struct list_head tasks;  
    24.     struct list_head ptrace_children;  
    25.     struct list_head ptrace_list;  
    26.   
    27.     struct mm_struct *mm, *active_mm;  
    28.   
    29. /* task state */  
    30.     struct linux_binfmt *binfmt;  
    31.     int exit_code, exit_signal;  
    32.     int pdeath_signal;  /*  The signal sent when the parent dies  */  
    33.     /* ??? */  
    34.     unsigned long personality;  
    35.     int did_exec:1;  
    36.     pid_t pid;  
    37.     pid_t __pgrp;       /* Accessed via process_group() */  
    38.     pid_t tty_old_pgrp;  
    39.     pid_t session;  
    40.     pid_t tgid;  
    41.     /* boolean value for session group leader */  
    42.     int leader;  
    43.     /*  
    44.      * pointers to (original) parent process, youngest child, younger sibling, 
    45.      * older sibling, respectively.  (p->father can be replaced with  
    46.      * p->parent->pid) 
    47.      */  
    48.     struct task_struct *real_parent; /* real parent process (when being debugged) */  
    49.     struct task_struct *parent; /* parent process */  
    50.     struct list_head children;  /* list of my children */  
    51.     struct list_head sibling;   /* linkage in my parent's children list */  
    52.     struct task_struct *group_leader;   /* threadgroup leader */  
    53.   
    54.     /* PID/PID hash table linkage. */  
    55.     struct pid_link pids[PIDTYPE_MAX];  
    56.   
    57.     wait_queue_head_t wait_chldexit;    /* for wait4() */  
    58.     struct completion *vfork_done;      /* for vfork() */  
    59.     int __user *set_child_tid;      /* CLONE_CHILD_SETTID */  
    60.     int __user *clear_child_tid;        /* CLONE_CHILD_CLEARTID */  
    61.   
    62.     unsigned long rt_priority;  
    63.     unsigned long it_real_value, it_prof_value, it_virt_value;  
    64.     unsigned long it_real_incr, it_prof_incr, it_virt_incr;  
    65.     struct timer_list real_timer;  
    66.     struct list_head posix_timers; /* POSIX.1b Interval Timers */  
    67.     unsigned long utime, stime, cutime, cstime;  
    68.     unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; /* context switch counts */  
    69.     u64 start_time;  
    70. /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */  
    71.     unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;  
    72. /* process credentials */  
    73.     uid_t uid,euid,suid,fsuid;  
    74.     gid_t gid,egid,sgid,fsgid;  
    75.     int ngroups;  
    76.     gid_t   groups[NGROUPS];  
    77.     kernel_cap_t   cap_effective, cap_inheritable, cap_permitted;  
    78.     int keep_capabilities:1;  
    79.     struct user_struct *user;  
    80. /* limits */  
    81.     struct rlimit rlim[RLIM_NLIMITS];  
    82.     unsigned short used_math;  
    83.     char comm[16];  
    84. /* file system info */  
    85.     int link_count, total_link_count;  
    86.     struct tty_struct *tty; /* NULL if no tty */  
    87. /* ipc stuff */  
    88.     struct sysv_sem sysvsem;  
    89. /* CPU-specific state of this task */  
    90.     struct thread_struct thread;  
    91. /* filesystem information */  
    92.     struct fs_struct *fs;  
    93. /* open file information */  
    94.     struct files_struct *files;  
    95. /* namespace */  
    96.     struct namespace *namespace;  
    97. /* signal handlers */  
    98.     struct signal_struct *signal;  
    99.     struct sighand_struct *sighand;  
    100.   
    101.     sigset_t blocked, real_blocked;  
    102.     struct sigpending pending;  
    103.   
    104.     unsigned long sas_ss_sp;  
    105.     size_t sas_ss_size;  
    106.     int (*notifier)(void *priv);  
    107.     void *notifier_data;  
    108.     sigset_t *notifier_mask;  
    109.       
    110.     void *security;  
    111.   
    112. /* Thread group tracking */  
    113.     u32 parent_exec_id;  
    114.     u32 self_exec_id;  
    115. /* Protection of (de-)allocation: mm, files, fs, tty */  
    116.     spinlock_t alloc_lock;  
    117. /* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */  
    118.     spinlock_t proc_lock;  
    119. /* context-switch lock */  
    120.     spinlock_t switch_lock;  
    121.   
    122. /* journalling filesystem info */  
    123.     void *journal_info;  
    124.   
    125. /* VM state */  
    126.     struct reclaim_state *reclaim_state;  
    127.   
    128.     struct dentry *proc_dentry;  
    129.     struct backing_dev_info *backing_dev_info;  
    130.   
    131.     struct io_context *io_context;  
    132.   
    133.     unsigned long ptrace_message;  
    134.     siginfo_t *last_siginfo; /* For ptrace use.  */  
    135. };  
  • 相关阅读:
    软件自动化测试工程师面试题集锦(1)
    IDEA Maven无法引入org.openjfx:javafx.base:11.0.0-SNAPSHOP
    Maven的dependency和dependencyManagement的区别
    在idea中创建多模块的SpringBoot项目
    MAVEN中三种packaging方式
    IntelliJ IDEA创建maven多模块项目
    Spring Boot 中使用 thrift 入门
    在IntelliJ IDEA使用.gitignore插件的方法和作用
    Git
    TortoiseGit安装、配置
  • 原文地址:https://www.cnblogs.com/shihaochangeworld/p/5544659.html
Copyright © 2020-2023  润新知