File tree 1 file changed +18
-8
lines changed
1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change 8
8
## 实验指导
9
9
10
10
- [ 测试文件] ( https://github.com/rcore-os/rCore_tutorial/blob/master/test/usr/fork_test.rs )
11
+
11
12
- 测试方法:` python3 test.py lab5 `
12
- - 参考输出
13
+
14
+ - 参考输出:
15
+
16
+ - 该输出仅供参考;
17
+ - 因为调度的不确定性,线程结束的顺序甚至申请到的 ` TID ` 会有不同;
18
+ - 故你的输出不需要和该输出完全一样;
19
+ - 在评阅过程中,我们会人工抽查运行结果。
20
+
13
21
``` rust
14
- I am father
15
- ret tid is : 2
16
- thread 0 exited , exit code = 0
17
- forking
18
- I am child
19
- ret tid is : 0
20
- thread 1 exited , exit code = 0
21
22
I am child
22
23
ret tid is : 0
23
24
thread 2 exited , exit code = 0
25
+ I am father
26
+ ret tid is : 2
27
+ thread 1 exited , exit code = 0
24
28
I am child
25
29
ret tid is : 0
30
+ thread 3 exited , exit code = 0
31
+ I am father
32
+ ret tid is : 3
26
33
thread 0 exited , exit code = 0
27
34
```
28
35
29
36
思考以下问题:
30
37
31
38
1 . 如何控制子进程的返回值?(线程管理)
39
+
32
40
<p ><font color =" white " >修改上下文中的 a0 寄存器。</font ></p >
33
41
2 . 目前尚未实现进程切分,是否可以偷懒把线程当进程用?
42
+
34
43
<p ><font color =" white " >目前,可以。(出于偷懒甚至不需要维护进程的父子关系)</font ></p >
35
44
3 . 如何复制一个线程?(虚拟内存管理)
45
+
36
46
<p ><font color =" white " >分配新的栈、新的页表,并将页表的内容进行复制和映射。</font ></p >
37
47
4 . 为什么这道题这么难分值还和其它题一样?
38
48
<p ><font color =" white " >因为有现成的代码可以参考呀(小声)</font ></p >
You can’t perform that action at this time.
0 commit comments