Page 1 of 1
is Task Switch necessary?
Posted: Tue Jun 28, 2005 11:00 pm
by AltCtrlDel
is it possible to implement multitasking without task switching?
i really cant understand its ramifications, if it is really important i will be very thankful if somebody clarifies it
thnx in advance
Re: is Task Switch necessary?
Posted: Tue Jun 28, 2005 11:00 pm
by carbonBased
If you can't switch tasks, then how can you have more then one task running?
Task switching is a requirement for multitasking in that it provides the mechanism to transfer control from one task to another.
That being said, the method of task switching can vary significantally. Pre-emptive task switching (methods typically based on a timer interrupt that pre-empt tasks in the middle of execution) is not required, if that's what you mean. One could use a co-operative multitasking approach (ala Win3.x).
I would suggest that pre-emptive is the way to go, though.
--Jeff
Re: is Task Switch necessary?
Posted: Wed Jun 29, 2005 11:00 pm
by smiddy
There are two types of task switching too...Hardware and Software. Hardware is by far more programmer friendly. Software means that you have to do a considerable amount of coding to make it work.
Re: is Task Switch necessary?
Posted: Wed Jun 29, 2005 11:00 pm
by rexlunae
smiddy wrote:There are two types of task switching too...Hardware and Software. Hardware is by far more programmer friendly. Software means that you have to do a considerable amount of coding to make it work.
I completely disagree. My OS does as little messing with segmentation as possible, and consequentially much of what the processor's multitasking does was not useful for me. I found it was extremely simple to just manually switch tasks on an iterrupt.
Re: is Task Switch necessary?
Posted: Thu Jun 30, 2005 11:00 pm
by smiddy
rexlunae wrote:I completely disagree. My OS does as little messing with segmentation as possible, and consequentially much of what the processor's multitasking does was not useful for me. I found it was extremely simple to just manually switch tasks on an iterrupt.
I'm sorry, I'm missing the part you disagree with. I didn't state anything about usefulness. Software task switching may be more useful, but that isn't the point I was making. Certainly anything you can do that doesn't limit your abilities can be more useful, I don't disagree. But the simple fact is hardware task switching is far more easier to implement since you already have everything setup in the hardware. The sheer lines of code difference between the two ways, hardware versus software, software requires more code.
Re: is Task Switch necessary?
Posted: Fri Jul 01, 2005 11:00 pm
by Legend
Well, but I have to disagree, for me at least it was easier to write down a stack layout for the stored state on the stack and code the few lines for a task switch then think about a concept too handle multiple TSS structures (whether I allocate them in the GDT or swap them in and out by hand), initiating a task switch etc.
In fact, I think that at least on Intel (don't know if there is even another platform with something similiar) is bloated.
Re: is Task Switch necessary?
Posted: Tue Jul 05, 2005 11:00 pm
by rexlunae
smiddy wrote:I'm sorry, I'm missing the part you disagree with. I didn't state anything about usefulness. Software task switching may be more useful, but that isn't the point I was making. Certainly anything you can do that doesn't limit your abilities can be more useful, I don't disagree. But the simple fact is hardware task switching is far more easier to implement since you already have everything setup in the hardware. The sheer lines of code difference between the two ways, hardware versus software, software requires more code.
I mentioned the usefullness because in an operating system which makes heavy use of segmentation, there would be much more code to do software task switching than I have in mine. I disagree with the statement that it takes more code to do a software task switch than a hardware task switch. I think the difference can be (depending on your OS's requirements) negligable. For my OS, the actual task switch is done in a function written partially in C which is about 10 lines long if I recall correctly, and the only code that ever deals specificly with a TSS is code that sets up the initial one at boot, so I don't have any code to manage TSSes.