Skip to content

Commit

Permalink
chore(lab/4): update format
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Mar 2, 2024
1 parent db4fc8b commit 81a0fcb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docs/labs/0x04/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -931,11 +931,11 @@ The factorial of 999999 under modulo 1000000007 is 128233642.

2. 😋 尝试在 `kernel/src/memory/frames.rs` 中实现帧分配器的回收功能 `FrameDeallocator`,作为一个最小化的实现,你可以在 `Allocator` 使用一个 `Vec` 存储被释放的页面,并在分配时从中取出。

3. 🤔 基于帧回收器的实现,在 `elf` 中实现 `unmap_range` 函数,从页表中取消映射一段连续的页面,并使用帧回收器进行回收。利用它实现进程栈的回收(利用 `ProcessData` 中存储的页面信息)**页表的回收将会在后续实现用实现,暂时不需要处理**
3. 🤔 基于帧回收器的实现,在 `elf` 中实现 `unmap_range` 函数,从页表中取消映射一段连续的页面,并使用帧回收器进行回收。利用它实现进程栈的回收(利用 `ProcessData` 中存储的页面信息)页表的回收将会在后续实现用实现,暂时不需要处理

4. 🤔 尝试利用 `UefiRuntime``chrono` crate,获取当前时间,并将其暴露给用户态,以实现 `sleep` 函数。

`UefiRuntime` 的实现:
`UefiRuntime` 的实现,它可能需要使用锁进行保护

```rust
pub struct UefiRuntime {
Expand All @@ -955,7 +955,7 @@ The factorial of 999999 under modulo 1000000007 is 128233642.
}
```

一个可能的 `sleep` 函数实现:
这里提供一个可能的 `sleep` 函数实现:

```rust
pub fn sleep(millisecs: i64) {
Expand All @@ -968,6 +968,10 @@ The factorial of 999999 under modulo 1000000007 is 128233642.
}
```

在实现后,写一个或更改现有用户程序,验证你的实现是否正确,尝试输出当前时间并等待一段时间。
> 当前实现是纯用户态、采用轮询的,这种实现是很低效的。
>
> 在现代操作系统中,进程会被挂起,并等待对应事件触发后重新被调度。
>
> 虽然不是最好,但是在目前的需求下,这已经足够了。

> 当前实现是纯用户态、采用轮询的,这种实现是很低效的。在现代操作系统中,进程会被挂起,并等待对应事件触发后重新被调度
在实现后,写一个或更改现有用户程序,验证你的实现是否正确,尝试输出当前时间并使用 `sleep` 函数进行等待

0 comments on commit 81a0fcb

Please sign in to comment.