linux内核task_struct结构体字段分析.pptVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
linux内核task_struct结构体字段分析

linux 内核源码分析 进程管理(一) 郭海林 2012.9.29 重要数据结构——双向链表(1) 结构体定义: struct list_head { struct list_head *next, *prev; }; 重要数据结构——双向链表(2) 为什么要使用这种结构? 容器机制——将对象嵌入到另一个对象中 怎样通过链表元素找到容器对象的实例? 重要数据结构——双向链表(3) .../include/linux/list.h 重要数据结构——散列表(1) 结构体定义 表头: struct hlist_head { struct hlist_node *first; }; 节点: struct hlist_node { struct hlist_node *next, **pprev; }; 重要数据结构——散列表(2) 进程结构体剖析(1) struct task_struct { volatile long state; /* -1 unrunnable, 0 runnable, 0 stopped */ //... long exit_state; //... } 进程结构体剖析(2) struct task_struct { //... struct list_head tasks; //将系统中所有进程通过双向链表链接起来! //... } 进程结构体剖析(3) struct task_struct { //... pid_t pid; //进程标识符(线程) pid_t tgid; //线程组的领头线程ID struct task_struct *group_leader; // threadgroup leader //... } 系统调用 getpid() 返回什么? 进程结构体剖析(4.1) struct task_struct { //... struct task_struct __rcu *real_parent; /* real parent process */ struct task_struct __rcu *parent; /* recipient of SIGCHLD, wait4() reports */ struct list_head children; /* list of my children */ struct list_head sibling; /* linkage in my parents children list */ //... } 进程结构体剖析(4.2) 假设现在有进程A,生成三个子进程B、C、D,B进程又生成一个子进程E。 五个task_struct怎么进行链接? 进程结构体剖析(5.1) struct task_struct { //... /* PID/PID hash table linkage. */ struct pid_link pids[PIDTYPE_MAX]; //... } 关键结构体 struct upid { int nr; struct pid_namespace *ns; struct hlist_node pid_chain; }; pid命名空间(1) pid命名空间(2) struct nsproxy { atomic_t count; struct uts_namespace *uts_ns; struct ipc_namespace *ipc_ns; struct mnt_namespace *mnt_ns; struct pid_namespace *pid_ns; struct net *net_ns; }; 结构图 重要函数(1) 根据进程的命名空间ns以及局部PID号nr,怎么找到进程的task_struct? nr,ns --- upid --- pid --- task_struct 重要函数(2) 给出task_struct、ID类型、命名空间,怎么取得命名空间局部的ID号? task_struct --- pid --- upid --- nr 重要函数(3) 对于一个新建的进程,怎么在各个命名空间内生成唯一的PID号? struct pid *alloc_pid(struct pid_namespace *ns) (见源代码) * list_head list_head list_head list_head n

文档评论(0)

yaobanwd + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档