#include "kernel/types.h"
#include "kernel/stat.h"
#include "user/user.h"
int main(int argc, char *argv[]) {
//If the user forgets to pass an argument
//sleep should print an error message.
if (argc < 2) {
fprintf(2, "plz input args\n");
exit();
}
//can't be negative
uint64 time = atoi(argv[1]);
sleep(time);
exit();
}
6.S081自闭笔记
Lab1: Xv6 and Unix utilities
环境问题
Ubuntu19.10
libvirglrenderer.so.0
版本过新导致qemu-system-riscv64
无法运行而且18.04也有问题,所以直接自己把qemu和riscv64给编译了,文件很大,下载编译需要很久
没代理网速不好建议直接放弃
sleep
最简单的 学会如何修改内核代码 就是让你写代码 系统调用都写好了 让你封装一下 并且了解知识点 并且提出了一些规范
pingpong
通过
pipe
实现两个process
的双向传递pipe()
函数实际上创建了两个文件描述符fd
而子进程中会同样创建 由此可以进程进程间的传递如果单向传递需要一组
Pipe
而双向传递需要两组pipe
。试验过一组不能实现双线传递
图片参考https://blog.csdn.net/oguro/article/details/53841949
prims
并发CSP模型communicating sequential processes
看不懂 自闭中所以呢?这和并发CSP模型有什么关系= = 现在认为并没啥关系
更像用进程模拟递归 而且代码还写的贼难受
网上的有关CSP的资料全是go语言
goroutine
图源:https://zhuanlan.zhihu.com/p/64823525
pipe
是两个进程通讯的手段,而如上图依次传递。而根据
pingpong
可知,进程的双向传递需要一组pipe
记得
printf
要放对位置 不然最后一次会把未定义地址的输出出来find
xargs