Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
d63ac118
提交
d63ac118
9月 08, 2016
创建
作者:
Robert Morris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
this might fix the reported deadlock, though I can't reproduce it.
上级
5bf3fbee
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
1 行删除
+17
-1
proc.c
proc.c
+17
-1
没有找到文件。
proc.c
浏览文件 @
d63ac118
...
...
@@ -82,6 +82,12 @@ userinit(void)
acquire
(
&
ptable
.
lock
);
p
=
allocproc
();
// release the lock in case namei() sleeps.
// the lock isn't needed because no other
// thread will look at an EMBRYO proc.
release
(
&
ptable
.
lock
);
initproc
=
p
;
if
((
p
->
pgdir
=
setupkvm
())
==
0
)
panic
(
"userinit: out of memory?"
);
...
...
@@ -99,6 +105,12 @@ userinit(void)
safestrcpy
(
p
->
name
,
"initcode"
,
sizeof
(
p
->
name
));
p
->
cwd
=
namei
(
"/"
);
// this assignment to p->state lets other cores
// run this process. the acquire forces the above
// writes to be visible, and the lock is also needed
// because the assignment might not be atomic.
acquire
(
&
ptable
.
lock
);
p
->
state
=
RUNNABLE
;
release
(
&
ptable
.
lock
);
...
...
@@ -141,6 +153,8 @@ fork(void)
return
-
1
;
}
release
(
&
ptable
.
lock
);
// Copy process state from p.
if
((
np
->
pgdir
=
copyuvm
(
proc
->
pgdir
,
proc
->
sz
))
==
0
){
kfree
(
np
->
kstack
);
...
...
@@ -165,6 +179,8 @@ fork(void)
pid
=
np
->
pid
;
acquire
(
&
ptable
.
lock
);
np
->
state
=
RUNNABLE
;
release
(
&
ptable
.
lock
);
...
...
@@ -227,7 +243,7 @@ wait(void)
acquire
(
&
ptable
.
lock
);
for
(;;){
// Scan through table looking for
zombie
children.
// Scan through table looking for
exited
children.
havekids
=
0
;
for
(
p
=
ptable
.
proc
;
p
<
&
ptable
.
proc
[
NPROC
];
p
++
){
if
(
p
->
parent
!=
proc
)
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论