Simple Scheduler
Posted: Mon Apr 20, 2015 2:26 pm
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.
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.