Comparing Conventional- and Modern Programming Languages for Developing a File System

University essay from Malmö universitet/Institutionen för datavetenskap och medieteknik (DVMT)

Author: Pontus Laos; Alexander Libot; [2021]

Keywords: File System; Rust; C; EXT2; Filsystem; Rust; C; EXT2;

Abstract: Most of the software stack is built upon C today. C is a very flexible language, but the flexibility also brings some safety risks, particularly when handling memory through pointers. Rust is a new programming language which can guarantee memory safety without performance-heavy runtime services such as garbage collection. In this article, two partial file systems are implemented based on the design of EXT2. One system is implemented in C — Nafs — and one system is implemented in Rust — Rufs. A number of benchmarks are also developed, with the purpose of testing the most common features of a file system. After running the benchmarks, the results showed that Nafs provided better performance for all but one feature. There could be many reasons for this, and some hypotheses are discussed. Aspects like different compiler optimizations, the use of pointer dereferencing vs. data structure representation, using dynamic memory, and using system calls are considered. Some optimizations to Rufs are also implemented, and their impact analyzed. Earlier research has shown that Rust can guarantee memory safety while still providing good performance. It has also shown that Rust can be used to implement system programs, such as operating system kernels. Over the course of this article, it is shown that safe Rust can be used to implement a file system — thereby guaranteeing a memory safe program. It is also shown that a file system implemented in safe Rust provides worse performance than a similar system written in C. Future work will have to tell whether a file system can be as performant in Rust as in C, by using different implementation methods or unsafe Rust for some of the most performance critical parts of the system.

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)