as i know, we can switch from one task to another by doing a jmp, iret ... to it's tss segment descriptor, the new task will continue executing till the end of its code the return to the parent task, but what about simulating multi CPUs ?
I know that this is possible by allowing each task to use cpu for a mement then switch to other task ...etc, how this can be done ? since we must call the new task from the other one?
Multitasking
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Multitasking
the trick is to switch from one task to another can be placed in the timer interrupt, so that the switch is invisible to the interrupted task ...
Re:Multitasking
So the timer is a sort of main thread (kernel i mean) that calls the other tasks? then how is the scheduling algortihm called (or is it part of the timer code)? or am i missing something?Pype.Clicker wrote: the trick is to switch from one task to another can be placed in the timer interrupt, so that the switch is invisible to the interrupted task ...
Only Human
-
Ozguxxx
Re:Multitasking
You can call your scheduler while handling timer interrupts and scheduler decides if current task will be dispatched or not, if it is dispatched then this task will be left into its tss while handling a timer interrupt and cpu will be switched into context of another thread that was previously saved while handling a timer interrupt.
. Interrupts are always occuring and they are handled in kernel context, or in a conforming code segment which is really not a good design I think... ON the other hand also you can make task switches at interrupts so you can have interrupt tasks but I dont think you will need anything like this since it severely decreases performance. (OK, this is arguable, I am not really knowing about performance.) I hope I am clear, good luck.
So, in that case timer is not a thread, so no chicken-egg chaos hereSo the timer is a sort of main thread
-
mr. xsism
Re:Multitasking
question about interrupts and tasking n such. When an interrupt is called by a ring3 app, does the ring change to ring0 since the interrupt's code is in kernel space?
-
Ozguxxx
Re:Multitasking
When an interrupt is called by a ring3 app, does the ring change to ring0 since the interrupt's code is in kernel space?
[tt]from Ozgunh82 posted on 22-Mar-04, 02:36pm[/tt]
Interrupts are always occuring and they are handled in kernel context
