xv6进程调度代码
来源:互联网 发布:linux安装网站安全狗 编辑:程序博客网 时间:2024/06/14 23:47
最近在研究libco,看到协程切换运行,于是想到很早之前看的xv6,于是翻了一下代码,看看进程调度,以及上下文切换的部分,怀念那段撸OS的日子
// Per-CPU process scheduler.// Each CPU calls scheduler() after setting itself up.// Scheduler never returns. It loops, doing:// - choose a process to run// - swtch to start running that process// - eventually that process transfers control// via swtch back to the scheduler.voidscheduler(void){ struct proc *p; for(;;){ // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->state != RUNNABLE) continue; // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. proc = p; switchuvm(p); p->state = RUNNING; swtch(&cpu->scheduler, p->context); switchkvm(); // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; } release(&ptable.lock); }}
阅读全文
0 0
- xv6进程调度代码
- XV6 进程调度分析
- xv6源码分析(六):进程调度
- xv6上下文切换代码
- xv6进程切换-swtch函数
- XV6源代码阅读--进程与内存管理
- 进程调度 ---CFS调度
- 进程调度
- 进程调度
- 进程调度
- 进程调度
- 进程调度
- 进程调度
- 进程调度
- 进程调度
- 进程调度
- 进程调度
- 进程调度
- win10 文件夹背景 win10教程
- 四元数&MPU9250
- Java 开发环境配置(Windows篇)
- MyBatis集成log4j
- oracle 学习笔记
- xv6进程调度代码
- 北京大学并非净土,北大方正便是明证
- SpringMVC注解
- java基础第十五天 集合
- java数据类型
- 数模培训记录
- SpringMVC 第二种 方式例子
- Spring和MyBatis的整合的查询小案例
- SpringMVC 解析器