Monthly Archives: May

New Version of Simplix, My Hobby Operating System

Some of you may remember this post about Simplix, my hobby operating system. The first version, published in Sept., was not able to do much and was really buggy. Over the next 9 months, as I was studying the inner workings of modern operating systems, I also wanted to experiment with some of the concepts and ideas I was learning. I decided to apply my newly acquired knowledge to a new version of Simplix I was secretly working on. This new version contains a lot of improvements:

  • Greatly improved the performance of the page allocator.
  • New high performance memory allocator (kmalloc/kfree)
  • Better handling of software exceptions: Kill the current process and display debug info.
  • New system calls. Simplix now supports exit, fork, waitpid, getpid, getppid, time, stime, sleep and brk.
  • New scheduling algorithm. This algorithm is ridiculously simple and not particularly efficient or elegant. It should however be fair to interactive jobs, while doing its best to accomodate CPU intensive tasks.
  • Implemented a small set of user space libraries, including string manipulations (string.h) and a trivial implementation of malloc and free copied directly from the book “The C Programming Language” by Brian W. Kernighan and Dennis M. Ritchie.
  • Much cleaner source tree, improved source code documentation, etc.

As you have probably noticed by now, this new version of Simplix still does not provide any I/O facility for user space tasks. I/O is probably the most complex part of an operating system, so I decided to put it off for a little while longer. In this version however, I decided to write a few sample programs:

  • A Unix time counter implemented as a kernel thread.
  • Another kernel thread that finds and prints prime numbers.
  • A user task that computes the first 10,000 decimals of the number PI.
  • A kernel thread that prints live information about the system.
  • A program that creates a lot of user space tasks, each of them sleeps for one second before exiting.

You can already take a look at the complete and up-to-date source code, and even download it. Compiling Simplix requires a not-too-ancient version of GCC, make, and a few basic command line tools available on almost all Unix systems (objcopy, dd, etc.) If you don’t feel like trying it out yourself, I put together a very short Flash video showing the system booting and running inside Bochs. You can also put the kernel binary on a floppy and try it on a real PC with a floppy drive. Cheers!

Note: If you can’t see the video below, it’s probably because you are reading this article using a news reader. If that’s the case, open this article in a web browser to view the video.

Get the Flash Player to see this content.

Our military loans give an opportunity