Simple Kernel in C

Projects Computer science

During the second year of university, I created a kernel for the ARMv7 instruction set. I went above and beyond what was required on this project, achieving a clean design and features such as a blocked process queue, piping, kill, and a simple filesystem. This was my favourite coursework so far. I found it very interesting to learn about and implement the things that we take for granted as programmers.

I tried to stick to POSIX as much as possible, and stuck to the Linux method of having everything as either a file or process. Because pipes and standard in/out were both “files”, I was able to implement both popen and piping of the output of a process to another process.

Features

System Calls and Helper Functions

All system calls conform to the equivilent poxix standard, except for close which will close the appropriate resource (no need for fclose or pclose) and set_nonblocking which is custom.

The following functions use system calls to provide a higher function:

Processes

Files

The kernel allows the use of file descriptors to refer to resources. They are implemented under the hood using function pointers, which means that the main part of the kernel doesn’t even know what type of file they are. Can be blocking or not.

Types: