Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Wasn't the issue that TSS/hardware switching had too much overhead which is why Linux uses/used software based switching?


Hardware context switching is quite fast and overhead free.

The problem is that commonly the hardware based switch will not save all registers and with software based switching you can be much more selective about what you do and eek out a bit more performance that way.


>Hardware context switching is quite fast and overhead free."

Everything I have read on hardware switching has indicated otherwise:

From:

https://wiki.osdev.org/Context_Switching#Hardware_Context_Sw...

>"Performance Considerations

Because the hardware mechanism saves almost all of the CPU state it can be slower than is necessary. For example, when the CPU loads new segment registers it does all of the access and permission checks that are involved. As most modern operating systems don't use segmentation, loading the segment registers during context switches may be not be required, so for performance reasons these operating systems tend not to use the hardware context switching mechanism. Due to it not being used as much CPU manufacturers don't optimize CPUs for this method anymore (AFAIK). In addition the new 64 bit CPU's do not support hardware context switches when in 64 bit/long mode."


I mentioned this in my comment, with software ctxs you can save a bit of time if you don't need to save and restore everything.

Outside that, hw ctxs is faster.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: