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

Using the file system from the kernel

You will need to use the Pintos file system for some projects, in order to load user programs from disk and implement file operation syscalls. In later projects, you will need to modify the file system. The provided file system already contains all the functionality needed to support the required syscalls. (We recommend that you do not change the file system for the User Programs project.) However, you will need to read some of the file system code, especially filesys.h and file.h, to understand how to use the file system. You should beware of these limitations of the Pintos file system:

  • No internal synchronization. Concurrent accesses will interfere with one another. You should use synchronization to ensure that only one process at a time is executing file system code.
  • File size is fixed at creation time. The root directory is represented as a file, so the number of files that may be created is also limited.
  • File data is allocated as a single extent. In other words, data in a single file must occupy a contiguous range of sectors on disk. External fragmentation can therefore become a serious problem as a file system is used over time.
  • No subdirectories.
  • File names are limited to 14 characters.
  • A system crash mid-operation may corrupt the disk in a way that cannot be repaired automatically. There is no file system repair tool anyway.
  • When a file is removed (deleted), its blocks are not deallocated until all processes have closed all file descriptors pointing to it. Therefore, a deleted file may still be accessible by processes that have it open.