💻 Xeros Kernel- 2 mins
This year I had the opportunity to take CPSC 415: Advanced Operating Systems, a class I was very excited about. As I've progressed through my college courses, I've found myself particularly drawn towards the systems side of computer science and software engineering, and so I was zealous to learn more about the behind-the-scenes action involved with the operation and creation of a kernel.
The kernel we created was targeted for the Intel x86 Architecture. We used a mixture of C and inline x86 assembly code to accomplish this task. Taking a hardware-up approach, we began by writing a kernel-level memory management system to allow for dynamic allocation of memory during runtime (kmalloc and kfree). Once this memory management system had been extensively tested and we were certain it was bug-free, we tackled process creation.
It was very cool to learn how processes are actually created and run. Long story short, when a process is created by the system, it has memory dynamically allocated for it (using our kmalloc implementation), and a pointer to the very end of this alloacted memory is obtained. From here, a 'fake' process context (EFLAGS, CS, and EIP, along with general purpose registers) is set up on this allocated memory space, with special care to make sure the process' address is stoped in EIP. Once this context has been set up and the process has been added to the ready queue, the process can be context switched into by the dispatcher, causing the specified process to begin running!
With this basic functionality, we went on to write code allowing for inter-process communication (IPC), including signals and message passing, various useful system calls, time-slicing and quantums, and a keyboard driver. Ultimately, we concluded the project by writing a basic shell with various commands that utilized the functionality we had implmented.
Although time consuming, this course and project were extremely rewarding, and ignited my passion for operating systems, as I will be going on next fall to take a graduate level course in this subject area, CPSC 508. I hope to further pursue OS and kernel development in the future, and potentially as a career someday! :)
P.S. - Here's an image of the shell!