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

rCore-Tutorial-Book-v3/chapter3/5exercise #37

Open
utterances-bot opened this issue Mar 4, 2021 · 14 comments
Open

rCore-Tutorial-Book-v3/chapter3/5exercise #37

utterances-bot opened this issue Mar 4, 2021 · 14 comments
Labels
comments An area where readers can discuss related topics after every article.

Comments

@utterances-bot
Copy link

chapter3练习 — rCore-Tutorial-Book-v3 0.1 文档

https://rcore-os.github.io/rCore-Tutorial-Book-v3/chapter3/5exercise.html

Copy link

BinaryHeap 是 std::collections 里的,但是我们无法使用 std,这该如何是好?

Copy link

作业要求实现 sys_gettime() 但提供的仓库里已经实现的是 sys_get_time()。 这两个的确是不同的函数还是只是笔误?另外测例里指出,gettime 有两个参数 ts: &TimeVal, tz: usize,其中的 TimeVal(sec, usec) 分别是指什么?

Copy link
Contributor

可以用alloc::collections::binary_heap::BinaryHeap, 不过似乎需要先实现heap allocator,可参考下一章第一节。
助教说按ts: &TimeVal, tz: usize做作业,这个接口的语义可以参考https://man7.org/linux/man-pages/man2/gettimeofday.2.html

Copy link

那么可以不使用BinaryHeap而是直接用O(n)枚举方法完成作业么

Copy link

如果按照 guide.md 里的语义,gettime返回值是 0 或 -1,而不是返回时间值本身,那么测例里面 get_time() < wait_for 岂不是没有意义了,应该全部改掉才对。

@zhanghx0905
Copy link
Contributor

如果按照 guide.md 里的语义,gettime返回值是 0 或 -1,而不是返回时间值本身,那么测例里面 get_time() < wait_for 岂不是没有意义了,应该全部改掉才对。

测例里面user系统调用的实现和示例代码也是不同的

@wyfcyx wyfcyx added the comments An area where readers can discuss related topics after every article. label Mar 14, 2021
@will7101
Copy link

BinaryHeap 是 std::collections 里的,但是我们无法使用 std,这该如何是好?

可以用这个crate,提供了不用动态分配内存的一些数据结构

Copy link

RUAN0007 commented Jun 7, 2021

Hi, 我怀疑stridepass的定义搞反了吧。根据字面意义, stride表示每一步跨越的步数, pass表示表示该进程当前已经运行的“长度”。根据作者 Carl A. Waldspurger 的博士生答辩slide第15页, 可见stride = stride1/ticket以及在allocation时, choose client C with minimum passC.pass += C.stride. (我假设论文中ticket与这里的priority意义相同)

Copy link

简答2的chapter5相关代码是不是指向错了,应该是scheduler(L119-L138)指向的是allocproc(L90-L98)

Copy link

为什么会有 Panicked at src/syscall.rs:130, sys_exit never returns!
看输出结果是调用了sys_exited,但是还是出现这个panick

Copy link

ch3-lab 的代码,跟当前版本的实验内容对不上。

@typhigh
Copy link

typhigh commented Jul 1, 2022

ch3-lab 的代码,跟当前版本的实验内容对不上。

you can copy user test from this:
https://github.com/LearningOS/rCore-Tutorial-Test-2022S

Copy link

kidcats commented Oct 16, 2022

你好,这里的实验代码不太能对上吧,在实验要求里

fn sys_task_info(id: usize, ts: *mut TaskInfo) -> isize

要求两个参数,id和ts,但是在测试代码中

assert_eq!(0, task_info(&info));

只使用了一个参数,请问是不是我哪里理解错了

@HangX-Ma
Copy link

HangX-Ma commented Jul 1, 2023

你好,这里的实验代码不太能对上吧,在实验要求里

fn sys_task_info(id: usize, ts: *mut TaskInfo) -> isize

要求两个参数,id和ts,但是在测试代码中

assert_eq!(0, task_info(&info));

只使用了一个参数,请问是不是我哪里理解错了

以最新的这个rCore-Tutorial-Code-2023S 实验指导书为准吧,这个 Tutorial 的维护好像停了,最新版的接口是对应的上的。 另外如果你是自己跟着 tutorial 把 OS 搭起来的, 测例中的 write 仅有一次。

感谢443的帮助,在2023S的测试环境中是实现了 flush 的, 两个 \n 会调用两次 flush 所以 sys_write 被调用了两次。版本不统一体验很糟糕... 😢

除此之外需要保证仅有 ch3_taskinfo 在运行, 不然几个时间点会产生很大偏差。

fn sys_task_info(ti: *mut TaskInfo) -> isize
struct TaskInfo {
    status: TaskStatus,
    syscall_times: [u32; MAX_SYSCALL_NUM],
    time: usize
}

pymongo pushed a commit to pymongo/rCore-Tutorial-Book-v3 that referenced this issue Aug 11, 2023
[Ch3] update user module to 2021autumn version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comments An area where readers can discuss related topics after every article.
Projects
None yet
Development

No branches or pull requests