📄 读核日记(二).htm
字号:
priority; cycles_t avg_slice; /* SMP and runqueue state */ 为多处理机定义的变量.
int has_cpu; int processor; int last_processor; int lock_depth; /* Lock
depth. We can context switch in and out of holding a syscall kernel
lock... */ 为了在进程树中排序, 定义的父子,兄弟指针 struct task_struct *next_task,
*prev_task; struct tas74k_struct *next_run, *prev_run; <BR>/* task state
*/ 定义可 task 运行的状态, 以及信号 struct linux_binfmt *binfmt; int exit_code,
exit_signal; int pdeath_signal; /* The signal sent when the parent dies
*/ /* 定义可进程的用户号,用户组以及进程组*/ unsigned long personality; int dumpable:1;
int did_exec:1; pid_t pid; pid_t pgrp; pid_t tty_old_pgrp; pid_t
session; /* boolean value for session group leader */ 是不是进程组的头文件 int
leader; /* * pointers to (original) parent process, youngest child,
younger sibling, * older sibling, respectively. (p->father can be
replaced with * p->p_pptr->pid) */ 父子进程的一些指针 struct task_struct
*p_opptr, *p_pptr, *p_cptr, *p_ysptr, *p_osptr; <BR>/* PID hash table
linkage. */ 在调度中用的一些hash 表 struct task_struct *pidhash_next; struct
task_struct **pidhash_pprev; <BR>/* Pointer to task[] array linkage. */
struct task_struct **tarray_ptr; <BR>struct wait_queue *wait_chldexit;
/* for wait4() 等待队列 */ struct semaphore *vfork_sem; /* for vfork() */
unsigned long policy, rt_priority; unsigned long it_real_value,
it_prof_value, it_virt_value; 进程的性质因为实时进程与普通进程的调度算法不一样所以应有变量区分
下面是进程的一些时间信息 unsigned long it_real_incr, it_prof_incr, it_virt_incr;
struct timer_list real_timer; struct tms times; unsigned long
start_time; long per_cpu_utime[NR_CPUS],
per_cpu_stime[NR_CPUS];定义了时间片的大小 /* mm fault and swap info: this can
arguably be seen as either mm-specific or thread-specific */ 内存信息
unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap; int
swappable:1; /* process credentials */ uid_t uid,euid,suid,fsuid; gid_t
gid,egid,sgid,fsgid; int ngroups; gid_t groups[NGROUPS]; kernel_cap_t
cap_effective, cap_inheritable, cap_permitted; struct user_struct *user;
以下英文注释很清楚 /* limits */ struct rlimit rlim[RLIM_NLIMITS]; unsigned short
used_math; char comm[16]; /* file system info */ int link_count; struct
tty_struct *tty; /* NULL if no tty */ /* ipc stuff */ <BR>struct
sem_undo *semundo; struct sem_queue *semsleeping; /* tss for this task
*/ struct thread_struct tss; /* filesystem information */ struct
fs_struct *fs; /* open file information */ struct files_struct *files;
/* memory management info */ struct mm_struct *mm; <BR>/* signal
handlers */ spinlock_t sigmask_lock; /* Protects signal and blocked */
struct signal_struct *sig; sigset_t signal, blocked; struct signal_queue
*sigqueue, **sigqueue_tail; unsigned long sas_ss_sp; size_t sas_ss_size;
}; 在分析完 这个结构之后, 还有很多问题要想, 也许不能读 但框架要搞好.需要向的问题有以下几个 1,在task_struct
中用的常量在那里定义呢, 如最大进程个数, 最多支持的cpu 个数,等等 2,在调用fork() 时, 系统是分配一块内存 会是这样么
malloc(1,sizeof(struct task_struck)) 拷贝一些变量,还是和服进程公用一部分内存.malloc
函数怎么实现(在内存管理那一部分,但此处我认为不能不想) 3,.对于线程来说, 又如何实现呢? 4, 调度策略函数 schedul()
有几种形势, 时间片轮转, 抢占式,优先级抢占式,
多级反馈制.除了时间片轮转外都要对进程树进行遍历,(对于实时进程的fifo机制不用)linux 是怎样保证了高效呢?如果把最大线成数修改,
效率会不会降低 5, 进程通讯用到的管道,信号结构如何. <BR><BR><BR>
<DIV align=right>发布人:netbull 来自:LinuxAid </DIV><BR></UL><IMG
src="读核日记(二).files/line.jpg"><BR>
<FORM action=post.php?skin=reart&ID=1594 method=post>
<UL>-- 发表评论 --<BR> 昵称:<INPUT name=name> Email:<INPUT
name=email><BR> 内容:<BR><TEXTAREA name=content rows=5 cols=56></TEXTAREA><BR> <INPUT type=submit value=确定回复> <INPUT type=reset value=清除></UL></FORM><IMG
src="读核日记(二).files/line.jpg"><BR>
<UL>
<LI>以下是对此文的评论:<BR><BR></LI></UL></TD><!--第三列-->
<TD vAlign=top align=left width="25%"> <IMG
src="读核日记(二).files/online.jpg" border=0>
<UL>
<LI><A href="http://www.heblinux.org/addnews.php"
target=_blank>新闻发布</A><BR><BR>
<LI><A href="http://www.heblinux.org/addart.php"
target=_blank>文献发布</A><BR><BR>
<LI><A href="http://www.heblinux.org/addsoft.php"
target=_blank>软件发布</A><BR><BR>
<LI><A href="http://www.heblinux.org/manger.php"
target=_blank>软件管理</A><BR></LI></UL><IMG height=5
src="读核日记(二).files/tabledi2.jpg" width="100%"><!--下载排行--> <IMG
src="读核日记(二).files/download.jpg" border=0> <BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=676">Red Hat
Linux</A> (78904)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=93">星际译王1.31版</A> (36834)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=219">Oracle9i
Enterprise</A> (36781)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=785">kylix</A> (35589)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=287">AOL
server</A> (27226)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=969">RedHat
中文环境</A> (25499)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=647">Chinput</A> (23572)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=1041">中软Linux</A> (21135)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=946">RedHat Linux
7.1正式</A> (20829)<BR> <A
href="http://www.heblinux.org/view.php?skin=soft&id=134">XteamLinux</A> (20642)<BR><IMG
height=5 src="读核日记(二).files/tabledi2.jpg" width="100%">
<!--文摘分类--> <IMG src="读核日记(二).files/artstyle.jpg" border=0>
<BR> <A
href="http://www.heblinux.org/arttype.php?dno=1">内核分析</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=2">网络技术及应用</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=3">应用编程</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=4">硬件应用</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=5">软件应用</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=6">系统管理</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=7">数据库应用</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=8">系统安全</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=9">Linux中文化</A><BR> <A
href="http://www.heblinux.org/arttype.php?dno=10">市场与观点</A><BR><IMG
height=5 src="读核日记(二).files/tabledi2.jpg" width="100%">
<BR><!--合作伙伴--> <IMG src="读核日记(二).files/friends.jpg" border=0>
<BR> <A href="http://www.5ilinux.com/"
target=_blank>我爱linux</A><BR> <A
href="http://www.heblinux.org/"
target=_blank>河北LINUX协会</A><BR> <A
href="http://www.xteamlinux.com.cn/"
target=_blank>冲浪软件下载中心</A><BR> <A
href="http://cosoft.org.cn/html/"
target=_blank>共创联盟</A><BR> <A
href="http://www.coventive.com.cn/"
target=_blank>XLinux</A><BR> <A
href="http://www.it365.net/"
target=_blank>诺金软件电脑网络</A><BR> <A
href="http://www.ch2000.com.cn/"
target=_blank>中文2000软件</A><BR> <A
href="http://www.csuu.com/"
target=_blank>中国Unix联盟</A><BR> <A
href="http://freewares.cn/"
target=_blank>自由软件在中国</A><BR> <A
href="http://www.pconline.com.cn/pcedu"
target=_blank>太平洋电脑信息网</A><BR> <A
href="http://www.linuxaid.com.cn/"
target=_blank>LinuxAid</A><BR> <A
href="http://www.cosoft.org.cn/"
target=_blank>共创软件联盟</A><BR> <A
href="http://wsdn.org/"
target=_blank>WEB程序开发网络</A><BR> <A
href="http://linux.softhouse.com.cn/"
target=_blank>软件屋Linux之家</A><BR> <A
href="http://ljb.vpnet.cn/"
target=_blank>随意网络</A><BR> <A
href="http://linux.ccidnet.com/"
target=_blank>赛迪网Linux专区</A><BR></TD></TR></TBODY></TABLE>
<CENTER>Completed in 0.0491750240326 seconds</CENTER>
<CENTER>COPYRIGHT 2002-2003 <FONT color=#9b2626>LinuxByte.net</FONT> <A
href="mailto:oneteam@mail.linuxbyte.net">联系本站</A></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -