3 ms·
> Most of the time the VM handles it for you Yes, and that's the definition of preemptive. There's nothing explicit about it if the VM handles it for you. What
by pron 12y ago
> Most of the time the VM handles it for you
Yes, and that's the definition of preemptive. There's nothing explicit about it if the VM handles it for you. What you're saying is that it cannot preempt kernel-thread blocking code.
> Real kernel threads doesn't have a lot of overhead and are almost always a much better choice.
Well, as usual, that depends. A kernel thread task-switch is 20-50us, while a fiber task-switch is a couple nanos at most; that's a 1-2 orders of magnitude difference.
- pron 12y agoSorry, I meant to say a couple hundred nanos.
- bjourne 12y agoThat's just wrong. The definition of preemptive multitasking isn't that it works most of the time. A definition that lax would mean almost any cooperative threading system would be counted as "preemptive." Also can you please find a reference that shows (Linux) kernel threads being 1-2 orders slower than user threads?