6 ms·
The more and more I read about modern garbage collection design the more and more it seems to be remeniscent of filesystem design. It makes me wonder if there'
by simcop2387 14y ago
The more and more I read about modern garbage collection design the more and more it seems to be remeniscent of filesystem design. It makes me wonder if there's some large parallels between them that can be used advantageously to benefit both. Things that people have learned work well on filesystems might apply to garbage collection and vice versa.
- oconnor0 14y agoHow so? Could you explain in more detail?
- simcop2387 14y agoA lot of what I've seen in the structures of how they keep track of things efficiently seem to be very similar. Though filesystems are adding a bit of extra data to it compared to the GC, (filenames, locations, etc) a number of the design constraints and things seem to be very very similar. Like the idea to keep track of what's free and doing the allocation seem to have very similar solutions even given the different constraints. I think part of this might also be because some of the more modern filesystems are being designed to also consider SSD which end up even closer to normal memory. The way that (at least at a layman's understanding) btrfs seems to handle COW looks very similar to how this new garbage collection is being designed for lua. And the arenas look very much like the extants in ext4 (not sure about that in btrfs). This also makes me wonder if a design that takes caching of the drive into account could make some small improvements on things. EDIT: added small snippet about the arenas.
- ithkuil 14y agoFilesystems and memory allocation algorithms do have something in common. The problem of allocating memory and managing free space etc exists also without GC. When hierarchical filesystems behave as pure trees, it's always possible to simply deallocate the storage of a deleted file, because the file cannot be pointed by more than one entry in the tree. Unix filesystems, however, do have a way of creating several references to the same file, namely hard links. In order to handle these multiple references (like having a program with multiple variables pointing to the same object) a kind of GC algorithm is used, which is simply a "reference counting GC". Reference counting is a simple technique which is appropriate in several cases but has it's drawbacks and it's One of these drawbacks can be illustrated by this quote: "One day a student came to Moon and said: “I understand how to make a better garbage collector. We must keep a reference count of the pointers to each cons.” Moon patiently told the student the following story: “One day a student came to Moon and said: ‘I understand how to make a better garbage collector... ”"
- caf 14y agoThis drawback is why sensible UNIX filesystems don't allow you to create hardlinks to directories.
- dons 14y agoConvergence. When we all have persistent, solid state drives, your filesystem will be your heap and GC...
- jmaygarden 14y agoTo what solid state drive technology are you referring that would make good use as a heap? I wouldn't think that NAND flash would be suitable due to the write/erase constraints.
- VMG 14y agoMRAM maybe? (http://en.wikipedia.org/wiki/Magnetoresistive_random-access_memory http://en.wikipedia.org/wiki/Magnetoresistive_random-access_...)
- mburns 14y agoMemristors?
- dons 14y agoWas thinking of this article earlier this week: http://lwn.net/Articles/498289/ http://lwn.net/Articles/498289/ (which I'm presuming is some MRAM thing)
- jasonwatkinspdx 14y ago1.) If capacity increases, for a given workload, overwriting updates save less capacity. So even without new technology, there's a trend towards less overwrites of a given block for a fixed workload. 2.) Memristor Memory
- Tuna-Fish 14y agoNAND flash is going away. Right now it loses half it's write endurance, and it's eraseblocks double in size, every shrink. Eraseblocks are already at 4MB and write endurance is below a 1000 writes, pretty soon additional shrinks will bring no value. This happens because of fundamental physical limits, and no-one believes they can be overcome -- even the biggest proponents are talking about delaying the inevitable for a few years instead of avoiding it. Right now, there is a hundred-billion-dollar stampede going on for finding out it's successor. Players include: MRAM (Toshiba, Hitachi, Hynix, IBM, Everspin(Freescale spinoff), Samsung, NEC) FeRAM (Ramtron, IBM, TI, Fujitsu, Samsung, Matsushita, Oki, Toshiba, Infineon, Hynix, Symetrix) ReRAM (HP, ITRI, IMEC, Panasonic, Rambus) CBRAM (NEC, Sony, Axon, Micron) PRAM (Intel, IBM, ST Micro, Samsung, Numoxys) I might have missed a few backers. Also, all names after a technology are not working together, especially in FeRAM there are multiple competing approaches. An interesting commonality about these technologies is that they all aim to be universal memories. That is, they intend to eventually replace both DRAM and Flash, and some are even aiming for the last cache levels in cpus. This will probably lead to some changes in system design. Although I think the people who are calling for the death of filesystems are going about it all wrong -- I expect the role of filesystems to expand, not shrink. All they need is new block layers. Note that while everyone says memristors (ReRAM), they aren't even the most likely candidate (if I'd have to pick, I'd say PRAM), HP just has the best marketing.
- ajross 14y agoI don't see the technical reasoning there, but I agree that there's a thematic parallel: they're both reasonably straightforward ideas with very clean user-facing stories. They can both be implemented very simply (literally as part of an undergraduate course -- I remember writing both). And they both have undesirable performance problems in certain regimes, the solution to which has been the unending quest of generations of incredibly smart programmers and academics. They have led to staggering complexity, weird bugs, huge near-unmaintainable codebases, and uncounted PhD theses. Whole careers have been aimed at this stuff. And frankly it's been, from many perspectives, mostly a waste. ZFS/btrfs are, for 95% of problems, indistinguishable from FFS/ext2 implementations that are a tiny fraction of their size. Modern Java and .NET VMs still have latency issues under GC pressure that were equally visible in Emacs Lisp a quarter century ago. Applications which have hard requirements that fly in the face of these systems don't use them. Serious storage servers don't use the filesystem except vestigially (i.e. they do manual sync on very large files, or they use a block device directly). Serious realtime apps don't do GC and manage memory themselves. And that's not going to change no matter how many PhD's we throw at the problem.
- cokernel_hacker 14y agoI am afraid that is not even close to accurate. If you define "95% of problems" to be "reading and writing data such that data is read and written" sure, great. However, there are two little, minor things that file systems care about: performance and safety. FFS/ext2 have neither of things. Neither ext2 nor FFS contain a journal nor do the copy-on-write metadata. Heck, if you "upgrade" to ext3, you get the journal but nothing that protects you from bit-rot. If you look at most drives on the market, you will see devices capable of corrupting data for certain after three years. Your journal'd filesystem does jack in this case, all it can do is ensure proper ordering of writes to metadata, no guarantees that the data will be any good once written. How about performance? Well, if you look at FFS/ext2 they are essentially terrible. Block-at-a-time allocators with no extent configuration. Good luck getting the most out of your storage media when you have your block tree data-structure. Granted, ZFS suffers from the same issue but btrfs's extent tree configuration certainly does not. IIRC, the state of the art ext[23] implementations use read ahead to ameliorate the problem but does not fundamentally cure it. If you look at ext4, they have adopted extent trees via their Htree structure. A filesystem like zfs/btrfs is pretty imune to bitrot, they can easily mirror their metadata and avoid overwriting their metadata like FFS/ext[234] making torn writes non-issues. They avoid the many pathologies that your "simpler" filesystem and trades the complexity for not needing a fsck mechanism in the face of data-corruption, one should only be needed in the face of implementation bugs (you should note that ZFS has no fsck, btrfs just recently obtained one). Oh, and if any of you think soft updates work, they don't. While it would be great if they really did work but in a world where drives actively reorder writes and do not respect SCSI/SATA/misc transport commands to flush their internal caches, then you do not get safety. This set of drives is considerably huge. tl;dr You are oversimplifying the complex.
- nwmcsween 14y ago'Filesystems' as in arbitrary data serialized to an arbitrary backing is absurdly stupid when said data has a structure as with all data. A semantic system that understands the data needs to be implemented at some point - why have n parsing implementations for a single data format? With a semantic 'object system' data becomes apart of programming.