4 ms·
A friend of mine had the realization that all optimization boils down to making lower layers understand higher layers' concerns, or higher level layers understa
by Ericson2314 11y ago
A friend of mine had the realization that all optimization boils down to making lower layers understand higher layers' concerns, or higher level layers understand on lower levels' concerns. Here are some examples off the top of my head:
POSIX fails as a high level interface:
- No (at all powerful) notion of transactions. Mutation without transactions is extraordinarily primitive.
- No multiple FS roots to indicate boundary across which data will never be synchronized. (This is also good for how to spread data across multiple devices, a low-level concern.)
- Overall pushes people to maintain their own structure within files rather than use FS's trees.
POSIX fails as a low level interface:
- No way to hint or control caching along the memory hierarchy.
- Block size, locality out of control.
- Can't statically disallow various non-free actions which are costly (ability to expand file), can only hope that not using them does incur penalty.
Perhaps ZFS an BTRFS made other approaches more viable/obvious, but these weakness are inherent to the API itself and the high level stuff was noticeably missing from the get-go.
- jstimpfle 11y ago> - No (at all powerful) notion of transactions. Mutation without transactions is extraordinarily primitive. There is nothing that prevents you from implementing these in userland. Does not belong in the kernel, since the kernel can't know what are your atoms that must be atomically committed. Research how databases do it. > - No multiple FS roots to indicate boundary across which data will never be synchronized. (This is also good for how to spread data across multiple devices, a low-level concern.) You can check what device a file belong to with stat(2). It's the st_dev member. You can also check it from the shell with the stat command. > - Overall pushes people to maintain their own structure within files rather than use FS's trees. And that's entirely ok. Hierarchies are not for databases. Database-y problems are not the problems that the POSIX fs solves. > - Block size, locality out of control. I actually heard that Unix filesystems have traditionally been quite good at preserving locality. That's why I don't know of any defrag tool for e.g. ext3. Overall, if the FS does not solve your problems, implement your own abstraction. That's perfectly ok.