Hacker News new | past | comments | ask | show | jobs | submit login

A 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.




Filesystems 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... ”"


This drawback is why sensible UNIX filesystems don't allow you to create hardlinks to directories.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: