xv6
Table of Contents
Background
Experience
This thread introduce my experience doing MIT 6.828 labs (version 2021).
DONE Lab 0 (xv6 and unix utilities)
- description
- https://pdos.csail.mit.edu/6.828/2021/labs/util.html
- readings
- Chapter 1 of xv6-book
Why File Descriptor Abstraction?
Hide the details of what we are connected to: could be a file, a I/O device or a pipe.
Why separate exec
and fork
?
With the two separated, shell has a chance to redict I/O without disturbing the main shell.
Example:
char *argv[2]; argv[0] = "cat"; argv[1] = 0; if (fork() == 0) { // child process close(0); open("input.txt", O_RDONLY); exec("cat", argv); }
What's dup
?
dup
duplicates an existing file descriptor and shares the offset with the original fd.
Note that if two fd do not share offsets if they are not created with dup
, even if we are using open
calls to the same file.
DONE Lab 1 (System Calls)
Digest:
- process & page table data structure.
- How to implement a syscall.
- kernel space function and user space function.