MIT 6.S081 Lab util

Compulsory exercises

Lab guidance

Boot xv6 (easy)

  • 启动xv6

在shell中

1
2
$ cd xv6-labs-2021
$ make qemu

在xv6 shell中列出文件

1
$ ls

在xv6中
Ctrl-p 打印进程信息
Ctrl-a x 退出qemu

sleep (easy)

  • 补全Makefile

1
$U/_sleep\
  • 测试

1
2
3
4
5
$ cd xv6-labs-2021

$ ./grade-lab-util sleep
# Or #
$ make GRADEFLAGS=sleep grade

pingpong (easy)

  • 图解
    pipe
    pipe2

  • 代码实现

primes (moderate)/(hard)

  • 图解
    primes

  • 根据分析需要使用两个管道分别用于左邻居和右邻居

  • 代码实现

find (moderate)

  • 阅读ls.c了解文件系统

  • 代码实现

xargs (moderate)

  • 了解xargs

    • 教程
    • 要求实现简易的xarg,即实现下列命令行调用
1
2
3
4
$ find . b | xargs grep hello

$ echo hello too | xargs echo bye
bye hello too
  • 代码实现(reference)

Optional challenge exercises

  • Write an uptime program that prints the uptime in terms of ticks using the uptime system call. (easy)

  • Support regular expressions in name matching for find. grep.c has some primitive support for regular expressions. (easy)

  • The xv6 shell (user/sh.c) is just another user program and you can improve it.

作者

huayi

发布于

2023-03-28

更新于

2023-04-11

许可协议