Home [MIT 6.S081 2021] [Lab Util]
Post
Cancel

[MIT 6.S081 2021] [Lab Util]

记录一下自己做实验的思路过程和代码,不保证代码的正确性,如果有任何问题欢迎指出和讨论。
课程地址 https://pdos.csail.mit.edu/6.S081/2021/schedule.html
lab地址 https://pdos.csail.mit.edu/6.S081/2021/labs/util.html
我的代码库 https://github.com/zyf123123/6.S081-Fall-2021

Boot xv6 (easy.)

配环境 将实验需要的tools全部安装即可 略过

sleep (easy.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "kernel/types.h"
#include "kernel/stat.h"
#include "user/user.h"

int
main(int argc, char *argv)
{
    if (argc < 2) {
        printf("Usage: sleep <ticks> \n");
        exit(1);
    }
    int time = atoi(&argv[1]);

    if (time < 0) {
        printf("Invalid time\n");
        exit(1);
    }
    sleep(time);
    exit(0);
}
This post is licensed under CC BY 4.0 by the author.
Recently Updated
Trending Tags

-

-

Trending Tags