Hardware or software multitasking?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
wat
Posts: 4
Joined: Sun Apr 30, 2017 10:28 pm
Libera.chat IRC: haaaaaalp
Location: WA, USA
Contact:

Hardware or software multitasking?

Post 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.
My OS: WatOS (GitHub)
MichaelPetch
Member
Member
Posts: 799
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Hardware or software multitasking?

Post by MichaelPetch »

Software. It is faster. x86-64 long mode dropped support for it as well.
LtG
Member
Member
Posts: 384
Joined: Thu Aug 13, 2015 4:57 pm

Re: Hardware or software multitasking?

Post 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.
wat
Posts: 4
Joined: Sun Apr 30, 2017 10:28 pm
Libera.chat IRC: haaaaaalp
Location: WA, USA
Contact:

Re: Hardware or software multitasking?

Post by wat »

Thanks
My OS: WatOS (GitHub)
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: Hardware or software multitasking?

Post 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).
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Post Reply