Open utterances-bot opened 5 months ago
我感觉那个tips可以再加一句。sys_gettime仍然需要实现。不然ch8_deadlock_sem1过不了。 因为ch8_deadlock_sem1里面89行sleep会用到user_lib里的gettime。
// ch8_deadlock_sem1.rs
...
for i in 0..THREAD_N {
tids[i] = thread_create(deadlock_test as usize, 0) as usize;
}
sleep(500); // 这里会用到sys_get_time
for _ in 0..THREAD_N {
semaphore_up(SEM_BARRIER);
}
let mut failed = 0;
...
// lib.rs
...
pub fn sleep(period_ms: usize) {
let start = get_time();
while get_time() < start + period_ms as isize {
sys_yield();
}
}
...
chapter8 练习 - rCore-Tutorial-Guide-2024S 文档
https://learningos.cn/rCore-Tutorial-Guide-2024S/chapter8/5exercise.html