Development of my homemade operating system Sortix 0.7 is currently underway and many milestones are already completed. In particular, this release will add proper support for filesystems, graphics, threads, and lots of user-space improvements.
I am currently working on adding proper support for kernel threads. This offers a much more convenient programming model in the kernel (it was previously cooperative). Note that the user-space environment has always been fully preempted, now the kernel is too. So far the system boots and runs using kernel threads and it is quite stable, except for a show-stopping bug in the program loader. The bug sometimes loads a program incorrectly which causes exotic crashes.
Building upon kernel threads is the upcoming VFS, which will allow the implementation of mount-points and user-space filesystems. ser-space filesystems are a central design decision in Sortix, where the users have complete control over their view on the filesystem.. Many planned Sortix features depend on user-space filesystem, for instance my ext2 driver which currently has read-only support. Having a real filesystem driver would also remove many limitations, for instance not being able to store files permanently and the initrd slowly running out of space. User-space filesystems have other uses too, for instance, I plan to make a tcp filesystem that can be mounted at /net/tcp. This would allow shell scripts to easily access the internet, but it would also allow a special kind of VPN connection if you mount another computer’s /net directory as your own. Linux has mostly kernel filesystems which often means that traditionally only root can mount filesystems, but it’s not common for users to want to mount filesystems. The Linux FUSE API offers such functionality, but I’m not completely satisfied with the implementation.
I’ve also researched real mode and BIOS calls and it sure isn’t pretty. In fact, it is not possible for 32-bit protected mode or 64-bit long mode operating systems to call the kernel directly (at least, not without gruesome hacks). So I coded a short routine that de-boots the CPU back to 16-bit real mode and calls the BIOS directly and then boots Sortix back up. It works surprisingly well.
There is an old standard called VESA Bios Extensions (VBE), which allows the operating system to easily use modern resolutions and perform 2D bitmap operations. With the BIOS support in place, I was able to code a simple graphics driver based upon VBE. Previously, I only had bitmap support for the BGA mechanism in modern virtual machines. The Sortix Video branch works on creating a simple framework for switching and detecting graphics modes as well as providing a framebuffer to the user-space applications. This API will expose the video modes and framebuffers as the /dev/video directory. Although, my VBE driver is currently quite slow on real hardware as it takes too long to transfer data to the graphics card pixel for pixel, although it performs well in virtual machines. Adding support for MTRRs may just fix the transfer speed problem by bulking up writes and therefore reducing write latency which is the bottleneck.
Here’s some miscellaneous improvements: The standard library, kernel, and shell now supports environmental variables. I’ve added a new initrd format which supports nested directories, permissions, timestamps, and more. I’ve successfully ported libfreetype to Sortix and rendered text to an off-scren buffer (soon onto /dev/video/fb). There is some initial work done on copy-on-write support, but it’s not working yet. And lots of other small improvements and bug fixes.
I expect to finish the above features before releasing Sortix 0.7 and naturally I’ll add many other small improvements. Sortix 0.8 will likely focus on security where I add users and groups as well as making the kernel more robust against malicious processes.