struct task_struct 结构分析 \linux-1.0\linux\include\linux\sched.h
生活随笔
收集整理的這篇文章主要介紹了
struct task_struct 结构分析 \linux-1.0\linux\include\linux\sched.h
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
//任務(wù)機(jī)構(gòu)體,大小大概1024字節(jié)
struct task_struct {/* these are hardcoded - don't touch */ //硬件代碼 不可被修改volatile long state; //狀態(tài)標(biāo)志 /* -1 unrunnable, 0 runnable, >0 stopped */ long counter; //計(jì)數(shù)long priority; //優(yōu)先權(quán)unsigned long signal; //信號(hào)unsigned long blocked; //信號(hào)標(biāo)志的bit映射 /* bitmap of masked signals */ unsigned long flags; //上個(gè)進(jìn)程標(biāo)志/* per process flags, defined below */ int errno; //出錯(cuò)代碼int debugreg[8]; //硬件編譯寄存器。/* Hardware debugging registers */ /* various fields */ //可變區(qū)域struct task_struct *next_task, *prev_task; //本結(jié)構(gòu)的鏈表雙向指針struct sigaction sigaction1[32]; //信號(hào)活動(dòng)數(shù)組unsigned long saved_kernel_stack; //內(nèi)核中保存的堆棧點(diǎn) unsigned long kernel_stack_page; //內(nèi)核堆棧頁(yè)int exit_code, exit_signal; //結(jié)束代碼,結(jié)束信號(hào)int elf_executable:1; //是否自己可以執(zhí)行標(biāo)志int dumpable:1; //是否可以拆卸標(biāo)志int swappable:1; //是否可以交換標(biāo)志int did_exec:1; //是否為執(zhí)行文件標(biāo)志//啟動(dòng)代碼點(diǎn),結(jié)束代碼點(diǎn),結(jié)束數(shù)據(jù)點(diǎn),斷點(diǎn)開(kāi)始點(diǎn),斷點(diǎn),堆棧開(kāi)始點(diǎn),虛擬映射頁(yè)開(kāi)始點(diǎn)!unsigned long start_code,end_code,end_data,start_brk,brk,start_stack,start_mmap;//變量開(kāi)始點(diǎn),變量結(jié)束點(diǎn),環(huán)境開(kāi)始點(diǎn),環(huán)境結(jié)束點(diǎn)unsigned long arg_start, arg_end, env_start, env_end;//進(jìn)程id,組,會(huì)話,引入點(diǎn)int pid,pgrp,session,leader;//分組數(shù)組int groups[NGROUPS];/* * pointers to (original) parent process, youngest child, younger sibling,* older sibling, respectively. (p->father can be replaced with * p->p_pptr->pid)*///指向最原始的進(jìn)程任務(wù)指針,父進(jìn)程任務(wù)指針,子進(jìn)程任務(wù)指針,新兄弟進(jìn)程任務(wù)指針,舊兄弟進(jìn)程任務(wù)指針。struct task_struct *p_opptr,*p_pptr, *p_cptr, *p_ysptr, *p_osptr;//任務(wù)隊(duì)列指針struct wait_queue *wait_chldexit; /* for wait4() *//** For ease of programming... Normal sleeps don't need to* keep track of a wait-queue: every task has an entry of its own*///real user ID (uid): 實(shí)際用戶(hù)ID,指的是進(jìn)程執(zhí)行者是誰(shuí)//effective user ID (euid): 有效用戶(hù)ID,指進(jìn)程執(zhí)行時(shí)對(duì)文件的訪問(wèn)權(quán)限//saved set-user-ID (saved uid): 保存設(shè)置用戶(hù)ID。是進(jìn)程剛開(kāi)始執(zhí)行時(shí),euid的副本。在執(zhí)行exec調(diào)用之后能重新恢復(fù)原來(lái)的effectiv user ID.unsigned short uid,euid,suid; //用戶(hù)ID,有效用戶(hù)ID,保存設(shè)置用戶(hù)IDunsigned short gid,egid,sgid; //組ID,有效組ID,保存設(shè)置組ID;unsigned long timeout; //超時(shí)時(shí)間unsigned long it_real_value, it_prof_value, it_virt_value; //真實(shí)間隔定時(shí)器計(jì)數(shù)器的當(dāng)前值,PROF間隔定時(shí)器計(jì)數(shù)器的當(dāng)前值,虛擬間隔定時(shí)器計(jì)數(shù)器的當(dāng)前值unsigned long it_real_incr, it_prof_incr, it_virt_incr; //真實(shí)間隔定時(shí)器計(jì)數(shù)器的初始值,PROF間隔定時(shí)器計(jì)數(shù)器的初始值,虛擬間隔定時(shí)器計(jì)數(shù)器的初始值long utime,stime,cutime,cstime,start_time; //用戶(hù)時(shí)間,系統(tǒng)時(shí)間,累計(jì)用戶(hù)時(shí)間,進(jìn)程啟動(dòng)時(shí)間unsigned long min_flt, maj_flt; //次要頁(yè)錯(cuò)誤的數(shù)量,主要頁(yè)錯(cuò)誤的數(shù)量unsigned long cmin_flt, cmaj_flt; //累計(jì)次要頁(yè)錯(cuò)誤,累計(jì)主要頁(yè)錯(cuò)誤struct rlimit rlim[RLIM_NLIMITS]; //右限制值數(shù)組unsigned short used_math; //被使用的數(shù)字unsigned short rss; /* number of resident pages */ //寄存頁(yè)號(hào)char comm[16]; //comm口struct vm86_struct * vm86_info; //86虛擬機(jī)結(jié)構(gòu)unsigned long screen_bitmap; //屏幕位映射
/* file system info */ //文件系統(tǒng)信息int link_count; //鏈接數(shù)int tty; //終端類(lèi)型 /* -1 if no tty, so it must be signed */unsigned short umask; //權(quán)限掩碼struct inode * pwd; //密碼節(jié)點(diǎn)指針struct inode * root; //root節(jié)點(diǎn)指針struct inode * executable; //執(zhí)行表節(jié)點(diǎn)指針struct vm_area_struct * mmap; //虛擬區(qū)域映射指針struct shm_desc *shm; //struct sem_undo *semun; //信號(hào)量操作標(biāo)志struct file * filp[NR_OPEN]; //已經(jīng)打開(kāi)的文件描述字?jǐn)?shù)組fd_set close_on_exec; //進(jìn)程所有文件描述符(文件句柄)的位圖標(biāo)
/* ldt for this task - used by Wine. If NULL, default_ldt is used */struct desc_struct *ldt; //局部描述符表
/* tss for this task */struct tss_struct tss; //任務(wù)狀態(tài)段信息結(jié)構(gòu)
#ifdef NEW_SWAPunsigned long old_maj_flt; /* old value of maj_flt */unsigned long dec_flt; /* page fault count of the last time */unsigned long swap_cnt; /* number of pages to swap on next pass */short swap_table; /* current page table */short swap_page; /* current page */
#endif NEW_SWAPstruct vm_area_struct *stk_vma; //虛擬區(qū)域映射指針
};
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)
總結(jié)
以上是生活随笔為你收集整理的struct task_struct 结构分析 \linux-1.0\linux\include\linux\sched.h的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: .Net笔试题 有答案
- 下一篇: Linux下编译安装openssl