3 ms·
>hardware multitasking The main reason this wasn't used more is that is isn't a good fit for what an OS needs to do. Jumping to a TSS or task gate saves the c
by rep_lodsb 4y ago
>hardware multitasking
The main reason this wasn't used more is that is isn't a good fit for what an OS needs to do.
Jumping to a TSS or task gate saves the current context and restores that for the new task, in one atomic operation. But most kernels save the registers on syscall/interrupt entry (while remaining in the context of the current task), and restore a possibly different context on exit when the current one gets suspended.
There is no way to do "half of a task switch" with the TSS mechanism, so it would always do useless work:
kernel code does:
push user registers
handle syscall / interrupt
select new task and jump to it
CPU does:
save context A (mostly garbage values at this point)
restore context B (containing previously saved garbage)
kernel code does:
pop user registers
return to ring 3
- Teknoman117 4y agoAh, that's a good point.
- deleted 4y ago[deleted]