Skip to main content Link Menu Expand (external link) Document Search Copy Copied

How user programs work

Pintos can run normal C programs, as long as they fit into memory and use only the system calls you implement. Notably, malloc cannot be implemented because none of the system calls required for memory allocation (for a minimal implementation, brk and sbrk) are required for this project. Note that until you complete Project 1 in its entirety, many programs will fail due to depending on unimplemented components; for example, until you implement the relevant part of the project, programs that use floating point operations will intermittently fail, as you won’t have implemented the functionality necessary for the kernel to save and restore the floating-point registers between context switches.

The src/examples directory contains a few sample user programs. The Makefile in this directory compiles the provided examples, and you can edit it to compile your own programs as well. Pintos can load ELF executables with the loader provided for you in userprog/process.c — it can be informative to try and see which Linux userland utils are able to run after you’ve implemented Project 1.

Until you copy a test program to the simulated file system, Pintos will be unable to do useful work. You should create a clean reference file system disk and copy that over whenever you trash your filesys.dsk beyond a useful state, which may happen occasionally while debugging.