Page 1 of 1

Hardware or software multitasking?

Posted: Sun Aug 06, 2017 9:58 pm
by wat
Should I use hardware multitasking via the TSS, or software multitasking with minimal TSS?

Which option is faster? Which is easier to program? I already know that hardware multitasking is not portable.

Re: Hardware or software multitasking?

Posted: Sun Aug 06, 2017 10:28 pm
by MichaelPetch
Software. It is faster. x86-64 long mode dropped support for it as well.

Re: Hardware or software multitasking?

Posted: Mon Aug 07, 2017 12:05 am
by LtG
Software is probably going to be a better choice.

I'd say they're both pretty much as easy, so no significant difference there.

Portability is also a non-issue, non of the hardware related stuff is portable anyway.

As for speed, I'm not sure. The general opinion is that software is faster, and it probably is for many kernel designs. For instance many syscalls don't actually switch processes and don't necessarily need to save much of the context. Assuming you do all the things that a hardware task switch does, then I doubt doing it manually in software is going to be faster. But if you don't do all the things then software can be faster.

And finally, as already mentioned, long mode doesn't support it. So if you want to do long mode there's no option.

Personally I wouldn't bother with hardware tasks witching mainly due to long mode support missing and prot mode is pretty much obsolete.

Re: Hardware or software multitasking?

Posted: Mon Aug 07, 2017 1:42 am
by wat
Thanks

Re: Hardware or software multitasking?

Posted: Mon Aug 07, 2017 2:04 am
by Korona
It should also be noted that hardware task switching cannot be used to change MSRs or segment bases. It also does not support (actually not so) newer CPU features like the FPU/SSE state. So the question is not hardware vs. software switching but software vs. hybrid switching and software wins by a large margin in this comparison (for reasons that have already been stated).