5 ms·
Bizarre. Linux must already have some kind of "database" system for keeping track of system resources. At best, the claim would be that Linux is using an ineffi
by incompatible 8y ago
Bizarre. Linux must already have some kind of "database" system for keeping track of system resources. At best, the claim would be that Linux is using an inefficient database, which seems unlikely.
- sbjs 8y agoYou would absolutely be surprised how far you can get using a process’s memory as it’s official database and just dumping it out to disk periodically for persistence. I kind of want to write an article but the article can’t do it justice: It’s something you need to experience yourself to fully appreciate it and be wowed like I was. I’m sure Linux uses files for its persistence layer for most cases.
- Filligree 8y agoWe're talking about the process table and so forth. It's never persisted at all.
- giovannibajo1 8y agoThat’s Redis’ initial persistence design, that is still available, but nowadays most people use it with append-only logs because it provides more resistance to random crashes (eg: power going off)
- unixietube 8y agoYup, I believe the kernel pretty much just uses linked lists (at least, all of the running processes are kept as a linked list). But when most of your resources only number in the tens of thousands, if that, a linked list works perfectly well. And I’m not a kernel hacker so I’m sure there are optimizations I’m not aware of.
- megous 8y agoMore like a tree. https://elixir.bootlin.com/linux/latest/source/include/linux/sched.h#L592 https://elixir.bootlin.com/linux/latest/source/include/linux...
- jacoblambda 8y agoI know the kernel uses trees for a good number of different things. I'd imagine that processes would be a BST of some time and I remember Linus mentioning RB-Trees. It would definitely make the most sense as RB-Trees have better access and insertion than a sorted linked list.