http://blog.csdn.net/qq_26768741/article/details/54348586
- struct Task_struct {
- volatile long state; /*-1 unrunnable, 0 runnable, >0 stopped */
- struct Thread_info *thread_info;
- atomic_t usage;
- unsigned long flags; / * per process flags, defined below * /
- unsigned long ptrace;
- int lock_depth; / * Lock Depth * /
- int Prio, Static_prio;
- struct List_head run_list;
- prio_array_t *array;
- unsigned long sleep_avg;
- long Interactive_credit;
- Unsigned long long timestamp;
- int activated;
- unsigned long policy;
- cpumask_t cpus_allowed;
- unsigned int time_slice, first_time_slice;
- struct list_head tasks;
- struct List_head ptrace_children;
- struct List_head ptrace_list;
- struct mm_struct *mm, *active_mm;
- /* Task State */
- struct LINUX_BINFMT *binfmt;
- int Exit_code, exit_signal;
- int pdeath_signal; / * The signal sent when the parent dies * /
- /* ??? */
- unsigned long personality;
- int did_exec:1;
- pid_t pid;
- pid_t __pgrp; /* Accessed via Process_group () */
- pid_t tty_old_pgrp;
- pid_t session;
- pid_t Tgid;
- / * Boolean value for session group leader * /
- int leader;
- /*
- * Pointers to (original) The parent process, youngest child, younger sibling,
- * older sibling, respectively. (P->father can replaced with
- * p->parent->pid)
- */
- struct task_struct *real_parent; /* Real parent process (when being debugged) */
- struct task_struct *parent; / * Parent Process * /
- struct list_head children; / * List of my children * /
- struct list_head sibling; / * Linkage in my parent ' s children list * /
- struct task_struct *group_leader; / * Threadgroup leader * /
- / * pid/pid Hash table linkage. * /
- struct Pid_link Pids[pidtype_max];
- wait_queue_head_t Wait_chldexit; /* for WAIT4 () */
- struct completion *vfork_done; /* for vfork () */
- int __user *set_child_tid; / * Clone_child_settid * /
- int __user *clear_child_tid; / * Clone_child_cleartid * /
- unsigned long rt_priority;
- Unsigned long it_real_value, It_prof_value, It_virt_value;
- Unsigned long it_real_incr, IT_PROF_INCR, IT_VIRT_INCR;
- struct timer_list real_timer;
- struct List_head posix_timers; / * posix.1b Interval Timers * /
- Unsigned long utime, stime, Cutime, Cstime;
- Unsigned long NVCSW, NIVCSW, CNVCSW, CNIVCSW; / * Context Switch counts * /
- U64 start_time;
- /* mm fault and swap info:this can arguably be seen as either mm-specific or thread-specific */
- Unsigned long Min_flt, Maj_flt, Nswap, Cmin_flt, Cmaj_flt, Cnswap;
- /* Process Credentials */
- uid_t Uid,euid,suid,fsuid;
- gid_t Gid,egid,sgid,fsgid;
- int ngroups;
- gid_t Groups[ngroups];
- kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
- int keep_capabilities:1;
- struct user_struct *user;
- /* Limits */
- struct Rlimit rlim[rlim_nlimits];
- unsigned short used_math;
- Char comm[16];
- /* File System Info */
- int Link_count, total_link_count;
- struct tty_struct *tty; / * NULL if no TTY * /
- /* IPC Stuff */
- struct Sysv_sem Sysvsem;
- /* Cpu-specific State of this task */
- struct thread_struct thread;
- /* FileSystem information */
- struct fs_struct *fs;
- /* Open File Information */
- struct files_struct *files;
- /* Namespace */
- struct namespace *namespace;
- /* Signal handlers */
- struct signal_struct *signal;
- struct sighand_struct *sighand;
- sigset_t blocked, real_blocked;
- struct sigpending pending;
- unsigned long sas_ss_sp;
- size_t sas_ss_size;
- Int (*notifier) (void *priv);
- void *notifier_data;
- sigset_t *notifier_mask;
- void *security;
- /* THREAD Group Tracking */
- U32 parent_exec_id;
- U32 self_exec_id;
- /* Protection of (de-) allocation:mm, files, FS, TTY */
- spinlock_t Alloc_lock;
- /* Protection of Proc_dentry:nesting Proc_lock, Dcache_lock, WRITE_LOCK_IRQ (&tasklist_lock); */
- spinlock_t Proc_lock;
- /* Context-switch Lock */
- spinlock_t Switch_lock;
- /* journalling FileSystem Info */
- void *journal_info;
- /* VM State */
- struct reclaim_state *reclaim_state;
- struct Dentry *proc_dentry;
- struct Backing_dev_info *backing_dev_info;
- struct Io_context *io_context;
- unsigned long ptrace_message;
- siginfo_t *last_siginfo; / * for ptrace use. */
- };
Process Control blocks and task_struct