3 ms·
Very theoretical question. If there was a usable microkernel, how hard would be it be to have an FS as a service? Are MacOS FS' processes or are they 'monolithi
by betaby 1y ago
Very theoretical question. If there was a usable microkernel, how hard would be it be to have an FS as a service? Are MacOS FS' processes or are they 'monolithic'?
- yjftsjthsd-h 1y agoIf there was a usable microkernel, then its filesystems would almost certainly be implemented in userspace; that's kinda the point of a microkernel. I can't speak to how Darwin does things, but I will point out that Linux and the BSDs have filesystems as userspace processes courtesy of FUSE; in their architecture that has a performance hit (caused by the context switching needed, I believe recently improved by use of io_uring), but it is a worked example of what you want.
- betaby 1y agoI'm aware of FUSE and used NTFS driver though it back then. So we should expect similar performance with microkernels?
- yjftsjthsd-h 1y agoIt depends:) Old microkernels infamously did have awful perf because they took that context switch hit on everything, not just filesystems. I am told, though, that that was solved a long time ago and modern microkernels have fairly good performance. I'm not a kernel dev, though; you'll have to do your own research to get details.
- xenadu02 1y agoSo FSKit is public API and supports userspace filesystems but on macOS most built-in filesystems are kernel modules. On iOS everything except APFS is userspace. Modern Darwin is mostly a monolithic kernel, though more and more things are moving to userspace where possible (eg DriverKit). One interesting side-effect of various spectre mitigations is silicon improving the performance of context switches. That has the side-effect of decreasing the cost of kernel/userspace transitions. It isn't nearly as expensive as people still believe - though it isn't free either.
- koverstreet 1y agoI think this would be the most usable microkernel these days, and yes, it does FS as a service: https://www.redox-os.org/ https://www.redox-os.org/ There's no inherent reason why a filesystem in userspace has to have a measurable performance impact over in-kernel, done right. It would be a lot of engineering work, though. Context switches aren't that expensive when you're staying on the same core, it's IPIs (waking up a thread on another CPU) that's inherently expensive; and you need zero copy to/from the pagecache, which is tricky. But it totally could be done.