4 ms·
I can't speak as to their motivations specifically, but one of the things that I've noticed from poking around the kernel API is that the kernel APIs are much m
by jcranmer 5y ago
I can't speak as to their motivations specifically, but one of the things that I've noticed from poking around the kernel API is that the kernel APIs are much more coherently designed than the conventional kernels we have are.
In particular, one of the key design goals appears to be a heavy use of a capabilities-enabled handle-based API, even for more conventional syscalls (e.g., mmap). One of the benefits of this approach is that it simplifies a lot more cross-process management stuff; you can inspect (or edit!) another process's memory maps, for example, with the same system call that a process would use to edit its own. It would also enable something like CreateRemoteThread; it would definitely be far easier to write a debugger for Fuchsia than it is for Linux.
- astrange 5y agoMach/Darwin/iOS has this and I suppose it's nice, but it does break down when you introduce POSIX compatibility, because you have to deal with the less expressive and insecure concepts like pids and file descriptors there.
- wallscratch 5y agoOs noob here, what’s less expressive / insecure about PIDs or file descriptors?
- jcranmer 5y agoPIDs and file descriptors are effectively global tables indexed by integers that are reused. This means that you have inherent race conditions: you want to an operation on pid X, but in between the time you decided you want to do it and the time you actually did it, pid X died and a new pid X was created. This is even worse for PIDs, since there's basically nothing you can do to actually have any sort of locking to avoid race conditions.