xv6

Table of Contents

Background

xv6 is a teaching operating system adopted by MIT operating system courses.

xv6-book introduce the design of xv6 operating system.

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)

description
https://pdos.csail.mit.edu/6.828/2021/labs/syscall.html

Digest:

  • process & page table data structure.
  • How to implement a syscall.
  • kernel space function and user space function.

TODO Lab 2 (Page Tables)

Lab 4 (Copy-on-write)

Lab 5 (Multithreading)

Author: expye(Zihao Ye)

Email: expye@outlook.com

Date: 2022-07-31 Sun 00:00

Last modified: 2022-12-27 Tue 07:18

Licensed under CC BY-NC 4.0