Linux 内核 V0.12

上传者: cms202054 | 上传时间: 2024-04-18 17:11:19 | 文件大小: 7.5MB | 文件类型: RAR
《Linux内核完全注释V3 0 pdf》 + Linux 0 11注释源码 + Linux 0 12 源码 这是由赵炯所写的 是Linux 内核开发来说相当不错的书籍 附带有注释的0 11源码 还有原生没注释的0 12源码 可以在source inside中对照查看 方便查找 对于学习内核是相当有帮助的 参考源码示例: 0 11注释 "schedule " is the scheduler function This is GOOD CODE There probably won"t be any reason to change this as it should work well in all circumstances ie gives IO bound processes good response etc The one thing you might take a look at is the signal handler code here NOTE Task 0 is the "idle" task which gets called when no other tasks can run It can not be killed and it cannot sleep The "state" information in task[0] is never used "schedule "是调度函数 这是个很好的代码 没有任何理由对它进行修改 因为它可以在所有的 环境下工作(比如能够对IO 边界处理很好的响应等) 只有一件事值得留意 那就是这里的信号 处理代码 注意 任务0 是个闲置 "idle" 任务 只有当没有其它任务可以运行时才调用它 它不能被杀 死 也不能睡眠 任务0 中的状态信息"state"是从来不用的 void schedule void { int i next c; struct task struct p; 任务结构指针的指针 check alarm wake up any interruptible tasks that have got a signal 检测alarm(进程的报警定时值) 唤醒任何已得到信号的可中断任务 从任务数组中最后一个任务开始检测alarm for p &LAST; TASK; p > &FIRST; TASK; p if p { 如果任务的alarm 时间已经过期 alarm<jiffies 则在信号位图中置SIGALRM 信号 然后清alarm jiffies 是系统从开机开始算起的滴答数(10ms 滴答) 定义在sched h 第139 行 if p >alarm && p >alarm < jiffies { p >signal | 1 << SIGALRM 1 ; p >alarm 0; } 如果信号位图中除被阻塞的信号外还有其它信号 并且任务处于可中断状态 则置任务为就绪状态 其中" BLOCKABLE & p >blocked "用于忽略被阻塞的信号 但SIGKILL 和SIGSTOP 不能被阻塞 if p >signal & BLOCKABLE & p >blocked && p >state TASK INTERRUPTIBLE p >state TASK RUNNING; 置为就绪(可执行)状态 } this is the scheduler proper: 这里是调度程序的主要部分 while 1 { c 1; next 0; i NR TASKS; p &task;[NR TASKS]; 这段代码也是从任务数组的最后一个任务开始循环处理 并跳过不含任务的数组槽 比较每个就绪 状态任务的counter(任务运行时间的递减滴答计数)值 哪一个值大 运行时间还不长 next 就 指向哪个的任务号 while i { if p continue; if p >state TASK RUNNING && p >counter > c c p >counter next i; } 如果比较得出有counter 值大于0 的结果 则退出124 行开始的循环 执行任务切换(141 行) if c break; 否则就根据每个任务的优先权值 更新每一个任务的counter 值 然后回到125 行重新比较 counter 值的计算方式为counter counter 2 + priority [右边counter 0 ] for p &LAST; TASK; p > &FIRST; TASK; p if p p >counter p >counter >> 1 + p >priority; } switch to next ; 切换到任务号为next 的任务 并运行之 } 0 12 "schedule " is the scheduler function This is GOOD CODE There probably won"t be any reason to change this as it should work well in all circumstances ie gives IO bound processes good response etc The one thing you might take a look at is the signal handler code here NOTE Task 0 is the "idle" task which gets called when no other tasks can run It can not be killed and it cannot sleep The "state" information in task[0] is never used void schedule void { int i next c; struct task struct p; check alarm wake up any interruptible tasks that have got a signal for p &LAST; TASK ; p > &FIRST; TASK ; p if p { if p >timeout && p >timeout < jiffies { p >timeout 0; if p >state TASK INTERRUPTIBLE p >state TASK RUNNING; } if p >alarm && p >alarm < jiffies { p >signal | 1<< SIGALRM 1 ; p >alarm 0; } if p >signal & BLOCKABLE & p >blocked && p >state TASK INTERRUPTIBLE p >state TASK RUNNING; } this is the scheduler proper: while 1 { c 1; next 0; i NR TASKS; p &task;[NR TASKS]; while i { if p continue; if p >state TASK RUNNING && p >counter > c c p >counter next i; } if c break; for p &LAST; TASK ; p > &FIRST; TASK ; p if p p >counter p >counter >> 1 + p >priority; } switch to next ; }">《Linux内核完全注释V3 0 pdf》 + Linux 0 11注释源码 + Linux 0 12 源码 这是由赵炯所写的 是Linux 内核开发来说相当不错的书籍 附带有注释的0 11源码 还有原生没注释的0 12源码 可以在source inside中对照查看 方便查找 对于学习 [更多]

文件下载

资源详情

[{"title":"( 214 个子文件 7.5MB ) Linux 内核 V0.12","children":[{"title":"namei.c <span style='color:#111;'> 37.20KB </span>","children":null,"spread":false},{"title":"console.c <span style='color:#111;'> 30.91KB </span>","children":null,"spread":false},{"title":"memory.c <span style='color:#111;'> 25.10KB </span>","children":null,"spread":false},{"title":"floppy.c <span style='color:#111;'> 23.49KB </span>","children":null,"spread":false},{"title":"console.c <span style='color:#111;'> 22.78KB </span>","children":null,"spread":false},{"title":"exec.c <span style='color:#111;'> 18.90KB </span>","children":null,"spread":false},{"title":"sched.c <span style='color:#111;'> 18.57KB </span>","children":null,"spread":false},{"title":"namei.c <span style='color:#111;'> 18.51KB </span>","children":null,"spread":false},{"title":"tty_io.c <span style='color:#111;'> 18.40KB </span>","children":null,"spread":false},{"title":"buffer.c <span style='color:#111;'> 17.71KB </span>","children":null,"spread":false},{"title":"hd.c <span style='color:#111;'> 17.14KB </span>","children":null,"spread":false},{"title":"inode.c <span style='color:#111;'> 14.92KB </span>","children":null,"spread":false},{"title":"super.c <span style='color:#111;'> 13.57KB </span>","children":null,"spread":false},{"title":"malloc.c <span style='color:#111;'> 13.50KB </span>","children":null,"spread":false},{"title":"memory.c <span style='color:#111;'> 13.15KB </span>","children":null,"spread":false},{"title":"main.c <span style='color:#111;'> 12.52KB </span>","children":null,"spread":false},{"title":"tty_io.c <span style='color:#111;'> 11.99KB </span>","children":null,"spread":false},{"title":"sys.c <span style='color:#111;'> 11.72KB </span>","children":null,"spread":false},{"title":"floppy.c <span style='color:#111;'> 11.39KB </span>","children":null,"spread":false},{"title":"math_emulate.c <span style='color:#111;'> 11.27KB </span>","children":null,"spread":false},{"title":"tty_ioctl.c <span style='color:#111;'> 10.70KB </span>","children":null,"spread":false},{"title":"exit.c <span style='color:#111;'> 10.31KB </span>","children":null,"spread":false},{"title":"open.c <span style='color:#111;'> 10.00KB </span>","children":null,"spread":false},{"title":"vsprintf.c <span style='color:#111;'> 9.96KB </span>","children":null,"spread":false},{"title":"exec.c <span style='color:#111;'> 9.68KB </span>","children":null,"spread":false},{"title":"sched.c <span style='color:#111;'> 9.08KB </span>","children":null,"spread":false},{"title":"buffer.c <span style='color:#111;'> 8.86KB </span>","children":null,"spread":false},{"title":"bitmap.c <span style='color:#111;'> 8.46KB </span>","children":null,"spread":false},{"title":"hd.c <span style='color:#111;'> 8.14KB </span>","children":null,"spread":false},{"title":"build.c <span style='color:#111;'> 8.12KB </span>","children":null,"spread":false},{"title":"exit.c <span style='color:#111;'> 8.08KB </span>","children":null,"spread":false},{"title":"sys.c <span style='color:#111;'> 7.62KB </span>","children":null,"spread":false},{"title":"ll_rw_blk.c <span style='color:#111;'> 7.59KB </span>","children":null,"spread":false},{"title":"malloc.c <span style='color:#111;'> 7.29KB </span>","children":null,"spread":false},{"title":"inode.c <span style='color:#111;'> 7.00KB </span>","children":null,"spread":false},{"title":"fork.c <span style='color:#111;'> 6.77KB </span>","children":null,"spread":false},{"title":"select.c <span style='color:#111;'> 6.23KB </span>","children":null,"spread":false},{"title":"tty_ioctl.c <span style='color:#111;'> 6.18KB </span>","children":null,"spread":false},{"title":"ramdisk.c <span style='color:#111;'> 6.13KB </span>","children":null,"spread":false},{"title":"read_write.c <span style='color:#111;'> 5.86KB </span>","children":null,"spread":false},{"title":"main.c <span style='color:#111;'> 5.63KB </span>","children":null,"spread":false},{"title":"signal.c <span style='color:#111;'> 5.61KB </span>","children":null,"spread":false},{"title":"super.c <span style='color:#111;'> 5.47KB </span>","children":null,"spread":false},{"title":"pipe.c <span style='color:#111;'> 5.42KB </span>","children":null,"spread":false},{"title":"build.c <span style='color:#111;'> 5.18KB </span>","children":null,"spread":false},{"title":"signal.c <span style='color:#111;'> 5.14KB </span>","children":null,"spread":false},{"title":"swap.c <span style='color:#111;'> 5.07KB </span>","children":null,"spread":false},{"title":"get_put.c <span style='color:#111;'> 5.02KB </span>","children":null,"spread":false},{"title":"traps.c <span style='color:#111;'> 4.97KB </span>","children":null,"spread":false},{"title":"file_dev.c <span style='color:#111;'> 4.82KB </span>","children":null,"spread":false},{"title":"open.c <span style='color:#111;'> 4.75KB </span>","children":null,"spread":false},{"title":"vsprintf.c <span style='color:#111;'> 4.69KB </span>","children":null,"spread":false},{"title":"ll_rw_blk.c <span style='color:#111;'> 4.62KB </span>","children":null,"spread":false},{"title":"convert.c <span style='color:#111;'> 4.25KB </span>","children":null,"spread":false},{"title":"char_dev.c <span style='color:#111;'> 4.09KB </span>","children":null,"spread":false},{"title":"block_dev.c <span style='color:#111;'> 3.95KB </span>","children":null,"spread":false},{"title":"bitmap.c <span style='color:#111;'> 3.91KB </span>","children":null,"spread":false},{"title":"fork.c <span style='color:#111;'> 3.86KB </span>","children":null,"spread":false},{"title":"fcntl.c <span style='color:#111;'> 3.33KB </span>","children":null,"spread":false},{"title":"serial.c <span style='color:#111;'> 2.91KB </span>","children":null,"spread":false},{"title":"pipe.c <span style='color:#111;'> 2.77KB </span>","children":null,"spread":false},{"title":"read_write.c <span style='color:#111;'> 2.74KB </span>","children":null,"spread":false},{"title":"mktime.c <span style='color:#111;'> 2.72KB </span>","children":null,"spread":false},{"title":"stat.c <span style='color:#111;'> 2.69KB </span>","children":null,"spread":false},{"title":"ramdisk.c <span style='color:#111;'> 2.68KB </span>","children":null,"spread":false},{"title":"truncate.c <span style='color:#111;'> 2.46KB </span>","children":null,"spread":false},{"title":"math_emulate.c <span style='color:#111;'> 2.08KB </span>","children":null,"spread":false},{"title":"char_dev.c <span style='color:#111;'> 2.05KB </span>","children":null,"spread":false},{"title":"div.c <span style='color:#111;'> 2.05KB </span>","children":null,"spread":false},{"title":"add.c <span style='color:#111;'> 1.95KB </span>","children":null,"spread":false},{"title":"ioctl.c <span style='color:#111;'> 1.94KB </span>","children":null,"spread":false},{"title":"stat.c <span style='color:#111;'> 1.83KB </span>","children":null,"spread":false},{"title":"file_dev.c <span style='color:#111;'> 1.81KB </span>","children":null,"spread":false},{"title":"ea.c <span style='color:#111;'> 1.76KB </span>","children":null,"spread":false},{"title":"printk.c <span style='color:#111;'> 1.75KB </span>","children":null,"spread":false},{"title":"block_dev.c <span style='color:#111;'> 1.72KB </span>","children":null,"spread":false},{"title":"ctype.c <span style='color:#111;'> 1.72KB </span>","children":null,"spread":false},{"title":"truncate.c <span style='color:#111;'> 1.65KB </span>","children":null,"spread":false},{"title":"mul.c <span style='color:#111;'> 1.48KB </span>","children":null,"spread":false},{"title":"mktime.c <span style='color:#111;'> 1.43KB </span>","children":null,"spread":false},{"title":"fcntl.c <span style='color:#111;'> 1.42KB </span>","children":null,"spread":false},{"title":"serial.c <span style='color:#111;'> 1.38KB </span>","children":null,"spread":false},{"title":"open.c <span style='color:#111;'> 1.22KB </span>","children":null,"spread":false},{"title":"ctype.c <span style='color:#111;'> 1.17KB </span>","children":null,"spread":false},{"title":"pty.c <span style='color:#111;'> 1.16KB </span>","children":null,"spread":false},{"title":"ioctl.c <span style='color:#111;'> 1.11KB </span>","children":null,"spread":false},{"title":"panic.c <span style='color:#111;'> 952B </span>","children":null,"spread":false},{"title":"compare.c <span style='color:#111;'> 904B </span>","children":null,"spread":false},{"title":"wait.c <span style='color:#111;'> 774B </span>","children":null,"spread":false},{"title":"_exit.c <span style='color:#111;'> 616B </span>","children":null,"spread":false},{"title":"execve.c <span style='color:#111;'> 607B </span>","children":null,"spread":false},{"title":"write.c <span style='color:#111;'> 545B </span>","children":null,"spread":false},{"title":"printk.c <span style='color:#111;'> 537B </span>","children":null,"spread":false},{"title":"panic.c <span style='color:#111;'> 448B </span>","children":null,"spread":false},{"title":"dup.c <span style='color:#111;'> 401B </span>","children":null,"spread":false},{"title":"close.c <span style='color:#111;'> 397B </span>","children":null,"spread":false},{"title":"open.c <span style='color:#111;'> 389B </span>","children":null,"spread":false},{"title":"setsid.c <span style='color:#111;'> 382B </span>","children":null,"spread":false},{"title":"wait.c <span style='color:#111;'> 253B </span>","children":null,"spread":false},{"title":"error.c <span style='color:#111;'> 234B </span>","children":null,"spread":false},{"title":"......","children":null,"spread":false},{"title":"<span style='color:steelblue;'>文件过多,未全部展示</span>","children":null,"spread":false}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明