[Linux] Process (12)--TASK_STRUCT structure

Source: Internet
Author: User

[CPP]View Plaincopy
  1. struct Task_struct {
  2. volatile long state; /*-1 not operational, 0 can run, >0 means stop */
  3. void *stack;
  4. atomic_t usage;
  5. unsigned long flags; /* per Process flag */
  6. unsigned long ptrace;
  7. int lock_depth; / * Large kernel lock depth * /
  8. int Prio, Static_prio, Normal_prio;
  9. struct List_head run_list;
  10. const struct sched_class *sched_class;
  11. struct sched_entity se;
  12. unsigned short ioprio;
  13. unsigned long policy;
  14. cpumask_t cpus_allowed;
  15. unsigned int time_slice;
  16. #if defined (config_schedstats) | | Defined (CONFIG_TASK_DELAY_ACCT)
  17. struct Sched_info sched_info;
  18. #endif
  19. struct list_head tasks;
  20. /* 
  21. * Ptrace_list/ptrace_children forms the list of my children
  22. * That's were stolen by a ptracer.
  23. */
  24. struct List_head ptrace_children;
  25. struct List_head ptrace_list;
  26. struct mm_struct *mm, *active_mm;
  27. /* Process Status */
  28. struct LINUX_BINFMT *binfmt;
  29. long exit_state;
  30. int Exit_code, exit_signal;
  31. int pdeath_signal; / * Signal sent at the end of the parent process * /
  32. unsigned int personality;
  33. unsigned did_exec:1;
  34. pid_t pid;
  35. pid_t Tgid;
  36. struct task_struct *real_parent; /* Real parent process (in case of being debugged) */
  37. struct task_struct *parent; /* Parental process, parent and real_parent differences: Real_parent is the father, the fork, the parent is the father, most of the time the father-in-God is a person, PS see is the father-in-god, when the father-in-the-fathers are not the same, For example, there is a situation, such as a father died, but also have a parent process, such as the 1th process will be treated as a parent process. But the process is not the number 1th fork out. */  
  38. struct list_head children; / * Child process Chain list * /
  39. struct list_head sibling; / * The linked list of child processes connected to the parent process * /
  40. struct task_struct *group_leader; / * Thread Group leader * /
  41. /* PID and PID hash list contact */
  42. struct Pid_link Pids[pidtype_max];
  43. struct List_head thread_group;
  44. struct completion *vfork_done; /* for vfork () */
  45. int __user *set_child_tid; / * Clone_child_settid * /
  46. int __user *clear_child_tid; / * Clone_child_cleartid * /
  47. unsigned long rt_priority;
  48. cputime_t Utime, Stime, utimescaled, stimescaled;
  49. Unsigned long NVCSW, NIVCSW; / * Context Switch Count * /
  50. struct Timespec start_time; / * Monotone time * /
  51. struct Timespec real_start_time; / * Time since startup * /
  52. Unsigned long min_flt, Maj_flt;
  53. cputime_t It_prof_expires, It_virt_expires;
  54. Unsigned long long it_sched_expires;
  55. struct List_head cpu_timers[3];
  56. /* Process Identity credentials */
  57. uid_t Uid,euid,suid,fsuid;
  58. gid_t Gid,egid,sgid,fsgid;
  59. struct Group_info *group_info;
  60. kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
  61. unsigned keep_capabilities:1;
  62. struct user_struct *user;
  63. Char Comm[task_comm_len]; / * The name of the executable file after removing the path * /
  64. /* File System Information */
  65. int Link_count, total_link_count;
  66. /* IPC Stuff */
  67. struct Sysv_sem Sysvsem;
  68. /* Current process-specific CPU information */
  69. struct thread_struct thread;
  70. /* FileSystem information */
  71. struct fs_struct *fs;
  72. /* Open File Information */
  73. struct files_struct *files;
  74. /* Namespace */
  75. struct Nsproxy *nsproxy;
  76. /* Signal handlers */
  77. struct signal_struct *signal;
  78. struct sighand_struct *sighand;
  79. sigset_t blocked, real_blocked;
  80. sigset_t Saved_sigmask; /* To is restored with tif_restore_sigmask * /
  81. struct sigpending pending;
  82. unsigned long sas_ss_sp;
  83. size_t sas_ss_size;
  84. Int (*notifier) (void *priv);
  85. void *notifier_data;
  86. sigset_t *notifier_mask;
  87. #ifdef config_security
  88. V OID *security;
  89. #endif
  90. /* Thread Group Tracking */
  91. U32 parent_exec_id;
  92. U32 self_exec_id;
  93. /* Log File System Information */
  94. void *journal_info;
  95. /* Virtual Memory status */
  96. struct reclaim_state *reclaim_state;
  97. struct Backing_dev_info *backing_dev_info;
  98. struct Io_context *io_context;
  99. unsigned long ptrace_message;
  100. siginfo_t *last_siginfo; / * for ptrace use. * /
  101. ...
  102. };

atomic_t usage; There are several processes that are using this structure

[Linux] Process (12)--TASK_STRUCT structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.