12

Intel IA-32 architecture a.k.a. x86 offers hardware task switching capabilities since 80386. It includes TR (task register), memory segmentation features such as Task State Segment, task gates, call gates etc. However, this capability is not used in modern OSes which perform context management differently (for numerous reasons). Largely, the hardware task switching is not favored by any modern CPU architecture, not just x86. Within modern x86 OSes, only rudimentary TSS usage (that could not be avoided) can be found.

I am looking for information about which historical or maybe modern operating systems, both small and large, niche or general purpose, use hardware task switching. I am aware that Linux kernel up to 1.3 used it. I could not found reliable information about the MS DOS and Windows families, but I suspect some early versions of them are bound to use TSS at its fullest.

  • 2
    Actually, there was task switching support in the 80286, which was partially developed with input from software vendors for early iterations of OS/2. – user12 Feb 13 at 19:13
  • Hw task switch was removed in IA-32e (x64). It faults now if you try to call/jmp a task gate/TSS descriptor while in IA-32e. – Margaret Bloom Feb 13 at 21:04
  • 1
    Even OS/2 2.0 eschewed the 386’s TSS as far as possible and only used one. – Stephen Kitt Feb 13 at 21:12
  • 1
    ... and DOS didn’t use the TSS at all (what with it being single-tasking and designed for the 8086). – Stephen Kitt Feb 13 at 21:18
  • 2
    Also relevant: Evolution of the x86 context switch in Linux, covering Linux’s use of multiple TSSs and hardware task switching up to 2.2, then software task switching still with multiple TSSs, then software task switching with a single TSS. – Stephen Kitt Feb 28 at 17:42
8

iRMX III is a real-time operating system for Intel 80386 and later processors, originally developed by Intel and now maintained by tenAsys. A quick look at the System Call Reference manual reveals that it uses call gates.

  • 2
    I haven't looked at the reference but what has a call gate to do with the task switch? You can use a TSS in a call gate descriptor, sure, but that's not mandatory. Does the document say you have to call a TSS? – Margaret Bloom Feb 13 at 20:50
  • A call gate is part of the family of functionality being asked about. I'm not familiar with iRMX beyond skimming manuals today, but the same manual mentions Task State Segments in object files. Intel would expect their own OSes to use their own hardware features. – John Dallman Feb 13 at 23:07
  • @JohnDallman "Intel would expect their own OSes to use their own hardware features." - good point! – Grigory Rechistov Feb 14 at 7:10
  • 1
    The OP is asking about the hardware task switching, it mentioned call gates just to give a bit of context. Call gates are orthogonal to task switching, an answer based on call gates presence is therefore not meaningful. The presence of TSS in object files (whatever that actually means) is potentially a stronger evidence than the presence of call gates. Your last point, while suggestive, is also meaningless. ICC (Intel's compiler) don't use FP or XMM, yet both are Intel's own hardware features. It's likely that iRMX is using hw TS anyway, I think you should quote the right section of the docs – Margaret Bloom Feb 14 at 9:23
5

MMURTL by Richard Burgess, was the subject of a book that Sams published as: Developing your own 32-bit Operating System.

MMURTL makes no attempt at portability, instead making direct (and heavy) use of the 386's hardware support for tasks, task switching, and pretty much everything else. The licensing conditions for either/both the book and code are fairly liberal:

As you may know, the source code to MMURTL itself if in the public domain. I did this to allow you to do anything you desire with it. Even build the "Son of MMURTL" - or daughter of MMURTL - that's OK, too. The rights to the book are mine and no longer belong to the original (or any) publisher. You are welcome to a free copy (on me) and you may also post whole copies where you like (when needed) and give them away. Please don't post sections of the book with providing a reference back to the book itself (here) mainly because I hate finding things where the source is not identified or available. That is all I ask of you (and it isn't much). Use it all in good heath and most of all, enjoy yourself. And don't forget to spend time with your family! It is important that you do.(or at least communicate if away from them).

If you're looking for examples of commercial use, this probably isn't very interesting (though it has apparently seen some commercial use). It's probably a lot more interesting for somebody who wants to write code making use of that part of the hardware.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.