So it’s been some time since I posted, unfortunately life has kept me on the go these past several weeks and I’ve had limited time at my desk. However, thankfully I was able to work on Ktux from my netbook and now I successfully have multitasking working! I attempted several previous implementations of a scheduler without success, this time I re-wrote mostly everything from scratch, minus a few lines of the timer ISR assembly code. Currently, the scheduler supports thread creation/destruction and basic priority adjustment with nice() (just adjusts the process quantum timeslice). Oh, and a simple yield() was implemented as well. As of the moment, I have a pointer array to keep track of the threads, but in the process of replacing with linked lists (same implementation Linux kernel uses).
The screenshot below demonstrates 4 threads of execution, 3 of them increment counters (with various priorities) and the final one just displays the values on the screen, then yields():
Now, of course with with multitasking support comes a whole new array of synchronization issues. I have intentionally followed the KISS principle thus far when developing the kernel framework, knowing that any substantial code would most likely need to be re-written with critical sections, locks, etc. Due to the complexities and time involved, I am fairly certain I will not aim for full SMP support in Ktux. A few basic atomic operations have been written, but for the moment I think I will just use something similar to the big kernel lock in Linux; performance is not my main concern here, getting something out the door that actually runs is.
Not sure where I will go from here, I know the virtual memory needs a *LOT* of work, it’s pretty ugly right now. From there, I think user-level thread support will be a logical next step.
