I've been thinking (I know it is a shock horror) about how to implement my schedular. Here is what i have come up with:
There is a link list of threads that are active. A thread is active when it is not waiting for a message(i.e. keyboard input, network communication, Window messages,etc..). The Timer interrupt cycles though the active threads and gives them a bit of cpu time. If a message is passed to a thread. the thread then is put in the active list ready for excution. if there are no processes in the active list the OS sleeps untill a thread becomes active.
Do you see any problems with this.
Scedular
Re:Scedular
Hi,
..why not have several linked lists of threads, one for each priority level?
That way you could have a high priority thread (e.g. the GUI) that always gets CPU time when it needs it and doesn't have to wait for 50 lower priority threads (like defrag or your compiler) to finish their time slices.
Cheers,
Brendan
No, but...B.E wrote:Do you see any problems with this.
..why not have several linked lists of threads, one for each priority level?
That way you could have a high priority thread (e.g. the GUI) that always gets CPU time when it needs it and doesn't have to wait for 50 lower priority threads (like defrag or your compiler) to finish their time slices.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.