Hacker News new | ask | show | jobs
by ryannielsen 5598 days ago
Why shouldn't the OS treat the HDD/SDD just as it does RAM: use up as much as possible in the background, while always ensuring the user's immediate needs come first? In other words, empty disk is wasted disk. Lion could quite easily use 'empty' disk space for document versioning or local backups, and immediately reap those versions/backups when the user actually does need that disk space.
1 comments

For HDDs (rather than SSD), there are very good technical reasons not to abuse the disk. Disk access is easily the slowest thing a computer. While everything else leapt ahead over the past several decades, seek times for hard disks have improved a fair amount, but nothing like the almost unbelievable improvements the other parts of your computer have gone through.

Your computer already kind of does what you describe: That's what virtual memory paging is. And when your system starts paging a lot, it's noticeably slower. And when your computer starts paging with a nearly full disk, it is an out-and-out dog.

Actually, I disagree. What I describe is more like RAM buffered IO, where the space can be reclaimed at no cost, rather than swap, where the data must be saved for coherency.

It's entirely viable for a filesystem to archive all of the data you've ever created. Treat the archived files as an LRU cache and, when new data needs to be saved, just write over the least recently used data. Instead of a volume bitmap of used blocks, you have a tree that can be traversed to get the blocks that can be overwritten. This is not data that must be saved, like the swap; it's data that should be saved until something else needs it, at which point it's overwritten, like most OS's RAM IO buffers.