multitasking and scheduling ?
Posted: Thu Mar 08, 2012 2:32 pm
I am wondering about few things
1) say I have a few TSS segments in the gdt . I can use ltr or str to switch/save tasks.
say I have a schedular algorithm (could be round robin ,First In First Out,Priority based scheduling, and many others...etc etc)
When I am in a particular task and have the schedular load a program and execute it.
I am wondering how I can get the control back from the program I have handed the control off to.
For example my loader program/schedular program can take an exe and load it into memory and jmp to the start address for that program.
But once the program that I loaded has control how can I get control back every 40ms or so.
The only thing I can think of is with an interrupt (Either the RTC or the PITS interrupt )
Are those the only ways to interrupt a running process / task to allow/beable to switch tasks or is their other ways ?
2) If I use the PITS or RTC then I am worried about a stack overflow.
Since every time an interrupt is called it pushes the eflags , cs , return address so every 40ms or so the stack would keep growing with no return/iret.
My problem is not in setting up a TSS segment in the GTD or loading/saving/switching a task (controlled by the tr register )
My problem is once the schedular I choose loads a program and hands control off how to get control back from the program that has control.
Thank you for any help with is.
1) say I have a few TSS segments in the gdt . I can use ltr or str to switch/save tasks.
say I have a schedular algorithm (could be round robin ,First In First Out,Priority based scheduling, and many others...etc etc)
When I am in a particular task and have the schedular load a program and execute it.
I am wondering how I can get the control back from the program I have handed the control off to.
For example my loader program/schedular program can take an exe and load it into memory and jmp to the start address for that program.
But once the program that I loaded has control how can I get control back every 40ms or so.
The only thing I can think of is with an interrupt (Either the RTC or the PITS interrupt )
Are those the only ways to interrupt a running process / task to allow/beable to switch tasks or is their other ways ?
2) If I use the PITS or RTC then I am worried about a stack overflow.
Since every time an interrupt is called it pushes the eflags , cs , return address so every 40ms or so the stack would keep growing with no return/iret.
My problem is not in setting up a TSS segment in the GTD or loading/saving/switching a task (controlled by the tr register )
My problem is once the schedular I choose loads a program and hands control off how to get control back from the program that has control.
Thank you for any help with is.
More interested in Preemptive Multitasking instead of tasks that have to execute and finish first before another task an execute