250707-250714 周记 2024-xv6-labs(1)
本周主要完成了2024-xv6-labs的util到cow的五个实验。 1. util lab1.1 sleep这个算是最简单的实验了。按照hints一步步写即可。没有任何额外需要注意的地方。 1.2 pingpong这个实验的主要难点是理解pipe函数的使用。先查看 sys_pipe函数: 1234567891011121314151617181920212223voidsys_pipe(void){ uint64 fdarray; // user pointer to array of two integers struct file *rf, *wf; int fd0, fd1; struct proc *p = myproc(); argaddr(0, &fdarray); if(pipealloc(&rf, &wf) < 0){ ... } ... if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf))...