Page 1 of 1

Simple Scheduler

Posted: Mon Apr 20, 2015 2:26 pm
by danielbj
I am implementing the simplest task manager I could imagine. It is designed around the general idea of my OS; keeping it simple, and conserve memory.

I am not using paging. Only Segmentation (protected mode). The philosophy is that everything is a service. This could be a process, data, a stack, a window (and keyboard buffer) etc.
All services has an ID: SID. The SID is an index into an imaginary table called the GXT. The GXT is the combination of the GDT and the GST (global service table). The GST functions as an extension for the GDT, so that you can store more information about a service than allowed by the GDT (Name, Extension, Type, Size, Parent ID (If PID=SID you've found a root service), base and segments in memory). GDT and GST are always updated through the GXT system calls, so that you cannot change the size of a service in GDT, without changing it in the GST.

For processes the GXT also contains the ESP and SS for the current stack. Now when receiving INT0, the OS just saves the state on stack, finds the next PID in queue, loads ESP and SS, pops state from stack, and IRETs. No priorities. No sleeping tasks. Simple.

Re: Simple Scheduler

Posted: Mon Apr 20, 2015 8:24 pm
by Brendan
Hi,
danielbj wrote:I am implementing the simplest task manager I could imagine. It is designed around the general idea of my OS; keeping it simple, and conserve memory.
Don't forget that "simple" is often the opposite of "good".

For example, by not using paging you're going to have to waste a lot of RAM and won't be able to conserve memory.

For example, by not having a sleeping tasks those tasks will loop until time has passed and waste a massive amount of CPU time.

For example, by not having task priorities the user will press a key and then spend 12 years waiting for the OS to respond because the CPU is busy executing unimportant things (like all those tasks that are looping until time has passed).

Mostly I can't understand why you're writing an OS in the first place. You're not going to learn how to write an OS by avoiding everything that's relevant, and no real users are likely to want to use something like that either.


Cheers,

Brendan

Re: Simple Scheduler

Posted: Tue Apr 21, 2015 3:34 am
by Kevin
Actually, trying to avoid standard practice often does teach you a lot. In most cases it just teaches you why the thing you wanted to avoid is in fact standard practice, and you'll learn it the hard way, but in the end I guess it gives you a better understanding of the problem at hand than avoiding mistakes by just doing what everyone else does.

Now I'm not sure if this is what you want, Daniel, but my prediction is that if you implement this, you'll learn a lot. ;)