Build and Run

Let's dive into the Pintos World!

Code Guidance

Now you've had a taste of the booting process of Pintos. Let's take a closer look at what's inside. Here's the directory structure that you can see in pintos/src:

  • "threads/"

    • Source code for the base kernel, which you will modify starting in project 1.

  • "userprog/"

    • Source code for the user program loader, which you will modify starting with project 2.

  • "vm/"

    • An almost empty directory. You will implement virtual memory here in project 3.

  • "filesys/"

    • Source code for a basic file system. You will use this file system starting with project 2, but you will not modify it until project 4.

  • "devices/"

    • Source code for I/O device interfacing: keyboard, timer, disk, etc. You will modify the timer implementation in project 1. Otherwise, you don't need to change this part.

  • "lib/"

    • An implementation of a subset of the standard C library. The code in this directory is compiled into both the Pintos kernel and user programs starting from project 2 that run under it. In both kernel code and user programs, headers in this directory can be included using the #include <...> notation. You have little need to modify this part.

  • "lib/kernel/"

    • Parts of the C library that are included only in the Pintos kernel. This also includes implementations of some data types that you are free to use in your kernel code: bitmaps, doubly linked lists, and hash tables. In the kernel, headers in this directory can be included using the #include <...> notation.

  • "lib/user/"

    • Parts of the C library that are included only in Pintos user programs. In user programs, headers in this directory can be included using the #include <...> notation.

  • "tests/"

    • Tests for each project. You can modify their codes if it helps you test your submissions. When grading, we will replace your tests/ directory with the original before we run the tests.

  • "examples/"

    • Example user programs for use starting from project 2.

  • "misc/" and "utils/"

    • These files may come in handy if you try working with Pintos on your own machine. Otherwise, you can ignore them.

You may feel overwhelmed by so many source files and have no idea where to start. Don't worry, now you only need to have a big picture in mind and the Code Guide section serves as a more comprehensive reference to the Pintos code. You can read the corresponding part of the reference guide according to the project you are working on or when it becomes important and necessary.

If you want to understand the dependencies of these modules and their functions, you can generate the code documentation with Doxygen. We provide an online code browser based on Doxygen here.

Last updated