5 ms·
> it required 386 specific features like task switching i thought this was a kernel/OS level concept, could you expand more?
by MuffinFlavored 3y ago
> it required 386 specific features like task switching
i thought this was a kernel/OS level concept, could you expand more?
- wkat4242 3y agoI'm not qualified to explain but the first answer to this question captures it well I think: https://retrocomputing.stackexchange.com/questions/26516/what-386-specific-features-did-linux-use https://retrocomputing.stackexchange.com/questions/26516/wha...
- js2 3y agox86 has hardware support for context switching, which is basically saving all the registers and jumping to a new address. https://en.wikipedia.org/wiki/Task_state_segment https://en.wikipedia.org/wiki/Task_state_segment
- MuffinFlavored 3y agodoes x86_64 use this?
- skissane 3y agox86-64 still requires Task State Segments (TSS), but it doesn't support using them for their original primary purpose of task switching; rather, they are needed for changing stacks when switching between user and kernel mode. In the original 386 design, the OS kernel would create a separate TSS for each OS process. In x86-64's vestigial use of the concept, there is a single TSS for each CPU, and every process running on that CPU shares the same TSS.
- Zuider 3y agoIt is a kernel/OS level concept (though it was also used in games.) Historically, task-switching had hardware support to some degree even in 8-bit microprocessors such as the Z80, M6809, and 6502 and in 16-bit microprocessors prior to the 386, using interrupts to push all the registers onto a stack, and setting the program counter to start executing instructions at a new address. The vital innovation introduced with the 386 was to add memory protection, so that the different tasks could not corrupt each other's allocated memory. Hitherto, multitasking was too unstable for serious commercial use.
- kragen 3y agoi agree about task switching; there's nothing 386-specific about longjmp, call/cc, or interrupts, and linux doesn't use the 386 tss (though it did at first: https://retrocomputing.stackexchange.com/questions/26516/what-386-specific-features-did-linux-use https://retrocomputing.stackexchange.com/questions/26516/wha...) however, hardware memory protection was an innovation of the early 01960s; it featured prominently in designs like the burroughs 5000 (01961), the ferranti atlas (01962), the cdc 6600 (01964), and the ibm 360 model 67 (01965) but the 80386 didn't ship until 01985, at which point hardware memory protection had been in off-the-shelf commercial computers for 24 years, very much in serious commercial use; in particular, most of the internet ran on pdp-10s, pdp-11s, vax-11s, and sun workstations, which all had memory protection. it had become universal in mainframes and almost so in minis during the 01970s, and even some micros like the lsi-11 and suns had it the 286 also had memory protection. what it lacked (like the pdp-11, including the lsi-11) was 32-bit registers. the 386's 32-bit register set meant you didn't have to use segmentation, which was a huge problem for 286 protected mode, and linux mostly doesn't
- Accujack 3y agoThe original Linux kernel used the task switching primitives included in the 80386 machine language. The tasks in the OS were directly mapped to 80386 tasks and task table entries, so the kernel was heavily tied to the 386 architecture. Linus himself once posted to USENet that it was unlikely Linux would ever run on anything but the 386 and its successors. Happily, he did the work to make himself wrong.