6 ms·
If userspace was really exceedingly slow then we wouldn't bother using it.
by lost_tourist 4y ago
If userspace was really exceedingly slow then we wouldn't bother using it.
- throwaway09223 4y agoI can explain why this isn't correct. We have a concept of userspace for safety. Systems without protected memory are very unstable. The tradeoff is speed. Trading speed for safety is extremely commonplace. * Every assert or runtime validation * Every time we guard against speculative execution attacks (enormous perf hits) * Every time we implement a "safe" runtime like java * process safety models using protected memory Efficiency is one of many competing concerns in a complex system.
- lost_tourist 4y agoThat's why I qualified it with "exceedingly slow" I would think in most cases a "bare metal" implementation would be quicker (and kernel for most intents is that), but user space is good enough for the vast majority of cases not involving direct bit twiddling in hardware. I know that user space is for simplicity and for safety (memory and security). I'm not a newb :) . I'm a developer, I'm just not a kernel dev (although I have written some very simple linux drivers for fun and to get a feel for it and tweaked existing drivers as well).
- yjftsjthsd-h 4y agoLeaving aside the general question (which sibling comment covers), there's an unwritten qualification of "userspace is generally seen as slow for drivers (network, disk, filesystem)", and... we generally don't bother using it for those things, or at least we try to move the data path into the kernel when we care about performance.