Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
0d948cbd
提交
0d948cbd
5月 06, 2011
创建
作者:
Frans Kaashoek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
p->next -> p->runq
上级
1403faf4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
13 行删除
+16
-13
proc.c
proc.c
+11
-11
proc.h
proc.h
+5
-2
没有找到文件。
proc.c
浏览文件 @
0d948cbd
...
...
@@ -93,7 +93,7 @@ addrun1(struct runq *rq, struct proc *p)
{
struct
proc
*
q
;
cprintf
(
"%d: add to run %d
\n
"
,
cpu
->
id
,
p
->
pid
);
for
(
q
=
rq
->
runq
;
q
!=
0
;
q
=
q
->
next
)
{
for
(
q
=
rq
->
runq
;
q
!=
0
;
q
=
q
->
runq
)
{
if
(
q
==
p
)
{
cprintf
(
"allready on q
\n
"
);
p
->
state
=
RUNNABLE
;
...
...
@@ -101,7 +101,7 @@ addrun1(struct runq *rq, struct proc *p)
}
}
p
->
state
=
RUNNABLE
;
// race?
p
->
next
=
rq
->
runq
;
p
->
runq
=
rq
->
runq
;
rq
->
runq
=
p
;
}
...
...
@@ -122,15 +122,15 @@ delrun1(struct runq *rq, struct proc *proc)
while
(
n
!=
0
)
{
if
(
n
==
proc
)
{
if
(
p
==
0
)
{
rq
->
runq
=
n
->
next
;
rq
->
runq
=
n
->
runq
;
}
else
{
p
->
next
=
n
->
next
;
p
->
runq
=
n
->
runq
;
}
n
->
next
=
0
;
n
->
runq
=
0
;
return
;
}
else
{
p
=
n
;
n
=
n
->
next
;
n
=
n
->
runq
;
}
}
}
...
...
@@ -261,7 +261,7 @@ exit(void)
// Pass abandoned children to init.
wakeupinit
=
0
;
for
(
c
=
0
;
c
<
NCPU
;
c
++
)
{
acquire
(
&
ptables
[
c
].
lock
);
acquire
(
&
ptables
[
c
].
lock
);
// XXX Unscalable
for
(
p
=
ptables
[
c
].
proc
;
p
<
&
ptables
[
c
].
proc
[
NPROC
];
p
++
){
if
(
p
->
parent
==
proc
){
p
->
parent
=
initproc
;
...
...
@@ -301,7 +301,7 @@ wait(void)
// Scan through table looking for zombie children.
havekids
=
0
;
for
(
c
=
0
;
c
<
NCPU
;
c
++
)
{
acquire
(
&
ptables
[
c
].
lock
);
acquire
(
&
ptables
[
c
].
lock
);
// XXX Unscalable
for
(
p
=
ptables
[
c
].
proc
;
p
<
&
ptables
[
c
].
proc
[
NPROC
];
p
++
){
if
(
p
->
parent
!=
proc
)
continue
;
...
...
@@ -350,7 +350,7 @@ steal(void)
if
(
c
==
cpunum
())
continue
;
acquire
(
&
runqs
[
c
].
lock
);
for
(
p
=
runqs
[
c
].
runq
;
p
!=
0
;
p
=
p
->
next
)
{
for
(
p
=
runqs
[
c
].
runq
;
p
!=
0
;
p
=
p
->
runq
)
{
if
(
p
->
state
==
RUNNABLE
)
{
cprintf
(
"%d: steal %d from %d
\n
"
,
cpunum
(),
p
->
pid
,
c
);
delrun1
(
&
runqs
[
c
],
p
);
...
...
@@ -386,7 +386,7 @@ scheduler(void)
// Loop over process table looking for process to run.
acquire
(
&
runq
->
lock
);
for
(
p
=
runq
->
runq
;
p
!=
0
;
p
=
p
->
next
)
{
for
(
p
=
runq
->
runq
;
p
!=
0
;
p
=
p
->
runq
)
{
if
(
p
->
state
!=
RUNNABLE
)
continue
;
...
...
@@ -617,7 +617,7 @@ procdump(int c)
cprintf
(
"
\n
"
);
}
cprintf
(
"runq: "
);
for
(
q
=
runqs
[
c
].
runq
;
q
!=
0
;
q
=
q
->
next
)
{
for
(
q
=
runqs
[
c
].
runq
;
q
!=
0
;
q
=
q
->
runq
)
{
if
(
q
->
state
>=
0
&&
q
->
state
<
NELEM
(
states
)
&&
states
[
q
->
state
])
state
=
states
[
q
->
state
];
else
...
...
proc.h
浏览文件 @
0d948cbd
...
...
@@ -46,7 +46,9 @@ struct proc {
struct
inode
*
cwd
;
// Current directory
char
name
[
16
];
// Process name (debugging)
struct
spinlock
lock
;
struct
proc
*
next
;
struct
proc
*
runq
;
struct
proc
*
waiterq
;
struct
proc
*
childq
;
};
// Process memory is laid out contiguously, low addresses first:
...
...
@@ -74,8 +76,9 @@ struct cpu {
};
struct
condvar
{
void
*
chan
;
// If non-zero, sleeping on chan
struct
spinlock
lock
;
struct
proc
*
waiters
;
void
*
chan
;
// If non-zero, sleeping on chan
};
struct
runq
{
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论