Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab 5: fork 的实现、并发与锁机制 #11

Merged
merged 4 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/labs/0x01/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
```json
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"linker-flavor": "ld.lld",
"target-endian": "little",
"target-pointer-width": "64",
Expand Down
2 changes: 1 addition & 1 deletion docs/labs/0x04/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 实验四:用户程序与系统调用

!!! tip "精巧的机械齿轮配合无声的引擎,构筑为处理万物而生的机械。<br/>&nbsp;<span style="font-weight: bold; float: right">by</span>"
!!! tip "精巧的机械齿轮配合无声的引擎,构筑为处理万物而生的机械。<br/>&nbsp;<span style="font-weight: bold; float: right">by ChatGPT</span>"

## 实验目的

Expand Down
2 changes: 1 addition & 1 deletion docs/labs/0x05/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 实验五:fork 的实现、并发与锁机制

!!! tip "<br/>&nbsp;<span style="font-weight: bold; float: right">by</span>"
!!! tip "在繁忙的十字路口指挥交通,需要一套精巧的规则,才能保证井然有序,避免冲突和事故。<br/>&nbsp;<span style="font-weight: bold; float: right">by Gemini</span>"

## 实验目的

Expand Down
3 changes: 2 additions & 1 deletion docs/labs/0x07/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
## 实验目的

1. 实现帧分配器的内存回收,操作系统的内存统计。
2. 尝试实现 mmap 系统调用,实现用户态的内存管理算法。
2. 实现操作系统栈的自动增长。
3. 尝试实现 mmap 系统调用,实现用户态的内存管理算法。

## 实验基础知识

Expand Down
2 changes: 1 addition & 1 deletion src/0x01/pkg/kernel/config/x86_64-unknown-none.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"linker-flavor": "ld.lld",
"target-endian": "little",
"target-pointer-width": "64",
Expand Down
2 changes: 1 addition & 1 deletion src/0x03/pkg/kernel/src/proc/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl PageTableContext {
}

/// Create a new page table object based on current page table.
pub fn clone(&self) -> Self {
pub fn clone_l4(&self) -> Self {
// 1. alloc new page table
let mut frame_alloc = crate::memory::get_frame_alloc_for_sure();
let page_table_addr = frame_alloc
Expand Down
4 changes: 2 additions & 2 deletions src/0x03/pkg/kernel/src/proc/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl ProcessInner {
}

pub fn clone_page_table(&self) -> PageTableContext {
self.page_table.as_ref().unwrap().clone()
self.page_table.as_ref().unwrap().clone_l4()
}

pub fn is_ready(&self) -> bool {
Expand All @@ -140,7 +140,7 @@ impl ProcessInner {
/// mark the process as running
pub(super) fn restore(&mut self, context: &mut ProcessContext) {
// FIXME: restore the process's context

// FIXME: restore the process's page table
}

Expand Down
2 changes: 1 addition & 1 deletion src/0x04/pkg/app/config/x86_64-unknown-ysos.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"llvm-target": "x86_64-unknown-ysos",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"linker-flavor": "ld.lld",
"target-endian": "little",
"target-pointer-width": "64",
Expand Down