Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
119872d2
提交
119872d2
3月 02, 2012
创建
作者:
Frans Kaashoek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
If there is a user-level wq library, maybe ls could use it like this
du with wq is more interesting
上级
c3171cdc
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
21 行增加
和
14 行删除
+21
-14
Makefrag
bin/Makefrag
+1
-0
pls.cc
bin/pls.cc
+20
-14
没有找到文件。
bin/Makefrag
浏览文件 @
119872d2
...
@@ -21,6 +21,7 @@ UPROGS= \
...
@@ -21,6 +21,7 @@ UPROGS= \
scripttest \
scripttest \
ftest \
ftest \
perf
perf
# pls
ifeq ($(HAVE_LWIP),y)
ifeq ($(HAVE_LWIP),y)
UPROGS += \
UPROGS += \
...
...
bin/pls.cc
浏览文件 @
119872d2
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include "stat.h"
#include "stat.h"
#include "user.h"
#include "user.h"
#include "fs.h"
#include "fs.h"
#include "wq.hh"
const
char
*
const
char
*
fmtname
(
const
char
*
path
)
fmtname
(
const
char
*
path
)
...
@@ -76,6 +77,8 @@ work(void *arg)
...
@@ -76,6 +77,8 @@ work(void *arg)
u64
tid
=
(
u64
)
arg
;
u64
tid
=
(
u64
)
arg
;
// grab and push work (may divide into blocks? and call ls on a block)?
// grab and push work (may divide into blocks? and call ls on a block)?
// maybe implement getdirent sys call that gives you some unread dir entry
// maybe implement getdirent sys call that gives you some unread dir entry
printf
(
"%d
\n
"
,
tid
);
while
(
wq_trywork
())
;
}
}
int
int
...
@@ -84,24 +87,27 @@ main(int argc, char *argv[])
...
@@ -84,24 +87,27 @@ main(int argc, char *argv[])
int
i
;
int
i
;
int
nthread
=
4
;
int
nthread
=
4
;
for
(
int
i
=
0
;
i
<
nthread
;
i
++
)
{
wq_init
(
nthread
);
// create a workqueue instance with nthread workers
sbrk
(
8192
);
void
*
tstack
=
sbrk
(
0
);
// fprintf(1, "tstack %lx\n", tstack);
int
tid
=
forkt
(
tstack
,
(
void
*
)
thr
,
(
void
*
)(
u64
)
i
);
if
(
0
)
fprintf
(
1
,
"pls[%d]: child %d
\n
"
,
getpid
(),
tid
);
}
//
push work wq.cc
//
create some intial work
if
(
argc
<
2
){
if
(
argc
<
2
){
ls
(
"."
);
// ls(".");
exit
();
struct
work
*
w
=
(
struct
work
*
)
malloc
(
sizeof
(
struct
work
));
w
->
rip
=
(
void
*
)
ls
;
w
->
arg0
=
(
void
*
)
"."
;
wq_push
(
w
);
}
else
{
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
// ls(argv[i]);
struct
work
*
w
=
(
struct
work
*
)
malloc
(
sizeof
(
struct
work
));
w
->
rip
=
(
void
*
)
ls
;
w
->
arg0
=
(
void
*
)
argv
[
i
];
wq_push
(
w
);
}
}
}
for
(
i
=
1
;
i
<
argc
;
i
++
)
ls
(
argv
[
i
]);
for
(
int
i
=
0
;
i
<
nthread
;
i
++
)
// start workers; terminate when all workers have no work
wai
t
();
wq_star
t
();
exit
();
exit
();
}
}
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论