提交 971c3376 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

prevent stealing of process already chosen by another cpu

上级 394c7889
......@@ -402,14 +402,16 @@ scheduler(void)
acquire(&p->lock);
release(&runq->lock);
// Switch to chosen process. It is the process's job
// to release proc->lock and then reacquire it
// before jumping back to us.
proc = p;
switchuvm(p);
p->state = RUNNING;
// Release runq lock only after setting RUNNING, to prevent stealing.
release(&runq->lock);
mtrace_fcall_register(pid, 0, 0, mtrace_pause);
mtrace_fcall_register(proc->pid, 0, 0, mtrace_resume);
mtrace_call_set(1, cpunum());
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论