Skip to content

Commit 8270a63

Browse files
committed
Modify the example output of lab-5 without compiling gitbook
1 parent 4a2eb58 commit 8270a63

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Diff for: exercise/part5.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,41 @@
88
## 实验指导
99

1010
- [测试文件](https://github.com/rcore-os/rCore_tutorial/blob/master/test/usr/fork_test.rs)
11+
1112
- 测试方法:`python3 test.py lab5`
12-
- 参考输出
13+
14+
- 参考输出:
15+
16+
- 该输出仅供参考;
17+
- 因为调度的不确定性,线程结束的顺序甚至申请到的 `TID` 会有不同;
18+
- 故你的输出不需要和该输出完全一样;
19+
- 在评阅过程中,我们会人工抽查运行结果。
20+
1321
```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
2122
I am child
2223
ret tid is: 0
2324
thread 2 exited, exit code = 0
25+
I am father
26+
ret tid is: 2
27+
thread 1 exited, exit code = 0
2428
I am child
2529
ret tid is: 0
30+
thread 3 exited, exit code = 0
31+
I am father
32+
ret tid is: 3
2633
thread 0 exited, exit code = 0
2734
```
2835

2936
思考以下问题:
3037

3138
1. 如何控制子进程的返回值?(线程管理)
39+
3240
<p><font color="white">修改上下文中的 a0 寄存器。</font></p>
3341
2. 目前尚未实现进程切分,是否可以偷懒把线程当进程用?
42+
3443
<p><font color="white">目前,可以。(出于偷懒甚至不需要维护进程的父子关系)</font></p>
3544
3. 如何复制一个线程?(虚拟内存管理)
45+
3646
<p><font color="white">分配新的栈、新的页表,并将页表的内容进行复制和映射。</font></p>
3747
4. 为什么这道题这么难分值还和其它题一样?
3848
<p><font color="white">因为有现成的代码可以参考呀(小声)</font></p>

0 commit comments

Comments
 (0)