秋霞电影网午夜鲁丝片无码,真人h视频免费观看视频,囯产av无码片毛片一级,免费夜色私人影院在线观看,亚洲美女综合香蕉片,亚洲aⅴ天堂av在线电影猫咪,日韩三级片网址入口

linux 內(nèi)核 task_struct 結構體字段分析

上傳人:沈*** 文檔編號:251346282 上傳時間:2024-11-07 格式:PPT 頁數(shù):19 大小:165KB
收藏 版權申訴 舉報 下載
linux 內(nèi)核 task_struct 結構體字段分析_第1頁
第1頁 / 共19頁
linux 內(nèi)核 task_struct 結構體字段分析_第2頁
第2頁 / 共19頁
linux 內(nèi)核 task_struct 結構體字段分析_第3頁
第3頁 / 共19頁

下載文檔到電腦,查找使用更方便

10 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《linux 內(nèi)核 task_struct 結構體字段分析》由會員分享,可在線閱讀,更多相關《linux 內(nèi)核 task_struct 結構體字段分析(19頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、單擊此處編輯母版標題樣式,單擊此處編輯母版文本樣式,第二級,第三級,第四級,第五級,*,*,*,linux 內(nèi)核源碼分析,進程管理(一),郭海林,2012.9.29,重要數(shù)據(jù)結構雙向鏈表(1),結構體定義:,struct list_head,struct list_head*next,*prev;,;,list_head,list_head,list_head,list_head,next,prev,next,prev,next,prev,next,prev,重要數(shù)據(jù)結構雙向鏈表(2),為什么要使用這種結構?,容器機制,將對象嵌入到另一個對象中,怎樣通過鏈表元素找到容器對象的實例?,next,

2、prev,task_struct,list_head,next,prev,task_struct,list_head,next,prev,task_struct,list_head,重要數(shù)據(jù)結構雙向鏈表(3),./include/linux/list.h,list_entry(p,t,m),已知類型為t的數(shù)據(jù)結構包含了一個list_head字段,該字段的名字是m,地址為p,返回類型為t的數(shù)據(jù)結構地址,list_entry(0 x.,struct task_struct,tasks),重要數(shù)據(jù)結構散列表(1),結構體定義,表頭:,struct hlist_head,struct hlist_no

3、de*first;,;,節(jié)點:,struct hlist_node,struct hlist_node*next,*pprev;,;,重要數(shù)據(jù)結構散列表(2),pprev,next,hlist_head,hlist_node,null,first,first,first,hlist_node,pprev,next,pprev,next,hlist_node,null,為什么要這么定義?,進程結構體剖析(1),struct task_struct,volatile long state;/*-1 unrunnable,0 runnable,0 stopped*/,/.,long exit_sta

4、te;,/.,進程的狀態(tài)宏定義:,#define,TASK_RUNNING,0,#define,TASK_INTERRUPTIBLE,1,#define,TASK_UNINTERRUPTIBLE,2,#define,_TASK_STOPPED,4,#define,_TASK_TRACED,8,/*in tsk-exit_state*/,#define,EXIT_ZOMBIE,16,#define,EXIT_DEAD,32,/.,進程結構體剖析(2),struct task_struct,/.,struct list_head tasks;,/,將系統(tǒng)中所有進程通過雙向鏈表鏈接起來!,/.,怎樣

5、訪問所有的進程呢?,#define,for_each_process(p),for(p=),#define,next_task(p),list_entry_rcu(p)-tasks.next,struct task_struct,tasks),給出全局pid號,怎么找到相應進程的task_struct?,進程結構體剖析(3),struct task_struct,/.,pid_t pid;,/進程標識符(線程),pid_t tgid;,/線程組的領頭線程ID,struct task_struct*group_leader;,/threadgroup leader,/.,系統(tǒng)調(diào)用 getpid(

6、)返回什么?,進程結構體剖析(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*/,/.,進程之間的

7、關系:,父子關系,兄弟關系,children,sibling,children,sibling,children,sibling,children,sibling,children,sibling,A,D,C,B,E,P,N,N,P,P,P,N,N,P,進程結構體剖析(4.2),假設現(xiàn)在有進程A,生成三個子進程B、C、D,B進程又生成一個子進程E。,五個task_struct怎么進行鏈接?,進程結構體剖析(5.1),struct task_struct,/.,/*PID/PID hash table linkage.*/,struct pid_link pidsPIDTYPE_MAX;,/.,

8、enum pid_type,PIDTYPE_PID,PIDTYPE_PGID,PIDTYPE_SID,PIDTYPE_MAX,;,/進程PID,/線程組領頭線程PID,/會話領頭進程ID,/類型個數(shù),pids0,pids1,pids2,關鍵結構體,struct,upid,int nr;,struct pid_namespace*ns;,struct hlist_node pid_chain;,;,struct,pid_link,struct hlist_node node;,struct pid*pid;,;,struct,pid,atomic_t count;,unsigned int le

9、vel;,struct hlist_head tasksPIDTYPE_MAX;,struct rcu_head rcu;,struct upid numbers1;,;,count,lever,task0,task1,task2,nr,node,pid,node,pid,ns,pid_chain,2,1,3,pid命名空間(1),1,2,3,4,5,6,7,8,10,9,2,1,3,1,lever 0,lever 1,lever 2,pid命名空間(2),struct nsproxy,atomic_t count;,struct uts_namespace,*uts_ns;,struct i

10、pc_namespace,*ipc_ns;,struct mnt_namespace*mnt_ns;,struct pid_namespace,*pid_ns;,struct net,*net_ns;,;,struct pid_namespace,/.,unsigned int,level,;,struct pid_namespace*,parent,;,/.,;,結構圖,見板書.,重要函數(shù)(1),根據(jù)進程的命名空間ns以及局部PID號nr,怎么找到進程的task_struct?,nr,ns -upid -pid -task_struct,struct pid*find_pid_ns(int

11、nr,struct pid_namespace*ns),struct task_struct*pid_task(struct pid*pid,enum pid_type type),重要函數(shù)(2),給出task_struct、ID類型、命名空間,怎么取得命名空間局部的ID號?,task_struct -pid -upid -nr,struct pid*task_pid(struct task_struct*task),pid_t pid_nr_ns(struct pid*pid,struct pid_namespace*ns),重要函數(shù)(3),對于一個新建的進程,怎么在各個命名空間內(nèi)生成唯一的PID號?,struct pid*alloc_pid(struct pid_namespace*ns),(見源代碼),

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關資源

更多
正為您匹配相似的精品文檔
關于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  sobing.com 裝配圖網(wǎng)版權所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!