how could i construct a while loop that allows execution of other system processes (in my while loop, even the system timer stops until it returns, therefore it doesnt return, because thew interrupts seem not to work)
thanks in advance.
A while loop
Re:A while loop
Set up an IDT. In your IRQ 0 handler, call the scheduler. Then, before your while loop, enable interrupts.
Alternatively, call the scheduler periodically from inside the while loop.
Alternatively, call the scheduler periodically from inside the while loop.
Re:A while loop
I have an IDT, and the scheduler is run by a while loop in main() (bad idea..), when i run it from both the main while loop and the loop i am using, the loop i am using never returns, and if i have no while loop in main() it'll crash, do i just have a blank while loop (or until i get my getc function (it depends on this) working, then i cna make it display a prompt)
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:A while loop
it's not enough to call the other process from your scheduler as a regular function call. You have to perform a task switch (either using TSSes or with a stack-switch approach)
Re:A while loop
I am using a scheduler function, i've moved it into the timer int and it works, but my while loop still doesn't, and the scheduler does a long jump to the task (kernel-based tasks right now) and so forth, no TSS, etc., but i'm not calling each task seperately
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:A while loop
when your scheduler is in the timer IRQ, it is called regardless of what the tasks do, and it can perform the switch.
If you just write a task that do, what will call your scheduler when it is in another task ...
i think that's where your problem comes from ...
If you just write a task that do
Code: Select all
while(1) schedule();
i think that's where your problem comes from ...