Вы находитесь на странице: 1из 3

註解

528 struct task_struct {


529 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped 七
個 states */
530 struct thread_info *thread_info;/*連結到 process descriptor 的小型資料結
構*/
531 atomic_t usage;
532 unsigned long flags; /* per process flags, defined below */
533 unsigned long ptrace;
534
535 int lock_depth; /* Lock depth */
536
537 int prio, static_prio;
538 struct list_head run_list;/*若 process priority 等於 k, 則 run_list 會把
process descriptor 連至擁有順序 k 的可執行 process 的 list*/
539 prio_array_t *array;/*runqueue 的主要資料結構是數個屬於 runqueue 的 process
descriptor 的 list, 而這些 list 均由 prio_array_t 所實作*/
540
541 unsigned long sleep_avg;
542 unsigned long long timestamp, last_ran;
543 int activated;
544
545 unsigned long policy;
546 cpumask_t cpus_allowed;
547 unsigned int time_slice, first_time_slice;
548
549 #ifdef CONFIG_SCHEDSTATS
550 struct sched_info sched_info;
551 #endif
552
553 struct list_head tasks;
554 /*
555 * ptrace_list/ptrace_children forms the list of my children
556 * that were stolen by a ptracer.
557 */
558 struct list_head ptrace_children;/*包含被 debugger 所追蹤的 P 的所有
children 之 list 的頭*/
559 struct list_head ptrace_list;/*指到在被追蹤的 process 的 real parent 的
list 中之前一和夏一個元素的指標*/
560
561 struct mm_struct *mm, *active_mm;
562
563 /* task state */
564 struct linux_binfmt *binfmt;
565 long exit_state;
566 int exit_code, exit_signal;
567 int pdeath_signal; /* The signal sent when the parent dies */
568 /* ??? */
569 unsigned long personality;
570 unsigned did_exec:1;
571 pid_t pid;
572 pid_t tgid;
573 /*
574 * pointers to (original) parent process, youngest child, younger
sibling,
575 * older sibling, respectively. (p->father can be replaced with
576 * p->parent->pid)
577 */
578 struct task_struct *real_parent; /* real parent process (when being
debugged) */
579 struct task_struct *parent; /* parent process */
580 /*
581 * children/sibling forms the list of my children plus the
582 * tasks I'm ptracing.
583 */
584 struct list_head children; /* list of my children */
585 struct list_head sibling; /* linkage in my parent's children
list */
586 struct task_struct *group_leader; /* threadgroup leader */
587
588 /* PID/PID hash table linkage. */
589 struct pid pids[PIDTYPE_MAX];
590
591 struct completion *vfork_done; /* for vfork() */
592 int __user *set_child_tid; /* CLONE_CHILD_SETTID */
593 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */
594
595 unsigned long rt_priority;
596 unsigned long it_real_value, it_real_incr;
597 cputime_t it_virt_value, it_virt_incr;
598 cputime_t it_prof_value, it_prof_incr;
599 struct timer_list real_timer;
600 cputime_t utime, stime;
601 unsigned long nvcsw, nivcsw; /* context switch counts */
602 struct timespec start_time;
603 /* mm fault and swap info: this can arguably be seen as either mm-specific
or thread-specific */
604 unsigned long min_flt, maj_flt;
605 /* process credentials */
606 uid_t uid,euid,suid,fsuid;
607 gid_t gid,egid,sgid,fsgid;
608 struct group_info *group_info;
609 kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
610 unsigned keep_capabilities:1;
611 struct user_struct *user;
612 #ifdef CONFIG_KEYS
613 struct key *session_keyring; /* keyring inherited over fork */
614 struct key *process_keyring; /* keyring private to this process
(CLONE_THREAD) */
615 struct key *thread_keyring; /* keyring private to this thread */
616 #endif
617 int oomkilladj; /* OOM kill score adjustment (bit shift). */
618 char comm[TASK_COMM_LEN];
619 /* file system info */
620 int link_count, total_link_count;
621 /* ipc stuff */
622 struct sysv_sem sysvsem;
623 /* CPU-specific state of this task */
624 struct thread_struct thread;
625 /* filesystem information */
626 struct fs_struct *fs;
627 /* open file information */
628 struct files_struct *files;
629 /* namespace */
630 struct namespace *namespace;
631 /* signal handlers */
632 struct signal_struct *signal;
633 struct sighand_struct *sighand;
634
635 sigset_t blocked, real_blocked;
636 struct sigpending pending;
637
638 unsigned long sas_ss_sp;
639 size_t sas_ss_size;
640 int (*notifier)(void *priv);
641 void *notifier_data;
642 sigset_t *notifier_mask;
643
644 void *security;
645 struct audit_context *audit_context;
646
647 /* Thread group tracking */
648 u32 parent_exec_id;
649 u32 self_exec_id;
650 /* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
651 spinlock_t alloc_lock;
652 /* Protection of proc_dentry: nesting proc_lock, dcache_lock,
write_lock_irq(&tasklist_lock); */
653 spinlock_t proc_lock;
654 /* context-switch lock */
655 spinlock_t switch_lock;
656
657 /* journalling filesystem info */
658 void *journal_info;
659
660 /* VM state */
661 struct reclaim_state *reclaim_state;
662
663 struct dentry *proc_dentry;
664 struct backing_dev_info *backing_dev_info;
665
666 struct io_context *io_context;
667
668 unsigned long ptrace_message;
669 siginfo_t *last_siginfo; /* For ptrace use. */
670 /*
671 * current io wait handle: wait queue entry to use for io waits
672 * If this thread is processing aio, this points at the waitqueue
673 * inside the currently handled kiocb. It may be NULL (i.e. default
674 * to a stack based synchronous wait) if its doing sync IO.
675 */
676 wait_queue_t *io_wait;
677 /* i/o counters(bytes read/written, #syscalls */
678 u64 rchar, wchar, syscr, syscw;
679 #if defined(CONFIG_BSD_PROCESS_ACCT)
680 u64 acct_rss_mem1; /* accumulated rss usage */
681 u64 acct_vm_mem1; /* accumulated virtual memory usage */
682 clock_t acct_stimexpd; /* clock_t-converted stime since last update
*/
683 #endif
684 #ifdef CONFIG_NUMA
685 struct mempolicy *mempolicy;
686 short il_next;
687 #endif
688 };

Вам также может понравиться