'How to implement software task switching?

I have read in intel manuals, AMD manuals and in other OS development forums how to implement task switching, but i still have some doubts on the use of TSS (Task State Segment).

I have read that TSS are used in hardware task switching, but (if I'm not wrong) are also used in the implementation of user space.

So, there are the questions that i have:

  • The TSS are implemented and used in hardware task switching? Or also in software task switching?
  • If TSS are not used in software task switching, can I program my own struct that stores all the useful data ?

I want to know the best strategies and the best practises about task switching. Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source