日韩欧美国产精品,在线播放国产区,欧美人与物videos另类一,日韩经典欧美一区二区三区,成人午夜视频在线,无毒不卡,香蕉97碰碰视频免费

linux 內(nèi)核 task_struct 結(jié)構(gòu)體字段分析

上傳人:沈*** 文檔編號(hào):251346282 上傳時(shí)間:2024-11-07 格式:PPT 頁(yè)數(shù):19 大?。?65KB
收藏 版權(quán)申訴 舉報(bào) 下載
linux 內(nèi)核 task_struct 結(jié)構(gòu)體字段分析_第1頁(yè)
第1頁(yè) / 共19頁(yè)
linux 內(nèi)核 task_struct 結(jié)構(gòu)體字段分析_第2頁(yè)
第2頁(yè) / 共19頁(yè)
linux 內(nèi)核 task_struct 結(jié)構(gòu)體字段分析_第3頁(yè)
第3頁(yè) / 共19頁(yè)

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

10 積分

下載資源

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

資源描述:

《linux 內(nèi)核 task_struct 結(jié)構(gòu)體字段分析》由會(huì)員分享,可在線閱讀,更多相關(guān)《linux 內(nèi)核 task_struct 結(jié)構(gòu)體字段分析(19頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。

1、單擊此處編輯母版標(biāo)題樣式,單擊此處編輯母版文本樣式,第二級(jí),第三級(jí),第四級(jí),第五級(jí),*,*,*,linux 內(nèi)核源碼分析,進(jìn)程管理(一),郭海林,2012.9.29,重要數(shù)據(jù)結(jié)構(gòu)雙向鏈表(1),結(jié)構(gòu)體定義:,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ù)結(jié)構(gòu)雙向鏈表(2),為什么要使用這種結(jié)構(gòu)?,容器機(jī)制,將對(duì)象嵌入到另一個(gè)對(duì)象中,怎樣通過(guò)鏈表元素找到容器對(duì)象的實(shí)例?,next,

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

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

4、te;,/.,進(jìn)程的狀態(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,/.,進(jìn)程結(jié)構(gòu)體剖析(2),struct task_struct,/.,struct list_head tasks;,/,將系統(tǒng)中所有進(jìn)程通過(guò)雙向鏈表鏈接起來(lái)!,/.,怎樣

5、訪問(wèn)所有的進(jìn)程呢?,#define,for_each_process(p),for(p=),#define,next_task(p),list_entry_rcu(p)-tasks.next,struct task_struct,tasks),給出全局pid號(hào),怎么找到相應(yīng)進(jìn)程的task_struct?,進(jìn)程結(jié)構(gòu)體剖析(3),struct task_struct,/.,pid_t pid;,/進(jìn)程標(biāo)識(shí)符(線程),pid_t tgid;,/線程組的領(lǐng)頭線程ID,struct task_struct*group_leader;,/threadgroup leader,/.,系統(tǒng)調(diào)用 getpid(

6、)返回什么?,進(jìn)程結(jié)構(gòu)體剖析(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*/,/.,進(jìn)程之間的

7、關(guān)系:,父子關(guān)系,兄弟關(guān)系,children,sibling,children,sibling,children,sibling,children,sibling,children,sibling,A,D,C,B,E,P,N,N,P,P,P,N,N,P,進(jìn)程結(jié)構(gòu)體剖析(4.2),假設(shè)現(xiàn)在有進(jìn)程A,生成三個(gè)子進(jìn)程B、C、D,B進(jìn)程又生成一個(gè)子進(jìn)程E。,五個(gè)task_struct怎么進(jìn)行鏈接?,進(jìn)程結(jié)構(gòu)體剖析(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,;,/進(jìn)程PID,/線程組領(lǐng)頭線程PID,/會(huì)話領(lǐng)頭進(jìn)程ID,/類型個(gè)數(shù),pids0,pids1,pids2,關(guān)鍵結(jié)構(gòu)體,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,;,/.,;,結(jié)構(gòu)圖,見(jiàn)板書(shū).,重要函數(shù)(1),根據(jù)進(jìn)程的命名空間ns以及局部PID號(hào)nr,怎么找到進(jìn)程的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號(hào)?,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),對(duì)于一個(gè)新建的進(jìn)程,怎么在各個(gè)命名空間內(nèi)生成唯一的PID號(hào)?,struct pid*alloc_pid(struct pid_namespace*ns),(見(jiàn)源代碼),

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

最新文檔

相關(guān)資源

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

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

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


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