0
$\begingroup$

I'm facing a task similar to what filesystems do. I have a bunch of continuous allocated space and I need to place pieces of variable length data into it, each piece of data can change size over time.

Now I could just place the pieces one after another as they come, then when they grow too big to fit I'd fragment the data or move the whole thing or whatever. To me it seems like a recipe for a fragmented mess though.

I'm sure there is no way to avoid a mess completely but I'd like to keep it to a minimum. Filesystems have to be using some cool strategies for placing data around the partition, right?

I do have some things to consider that differ from filesystems, like some data pieces I'd like to keep close together to be able to go through them with a sequential read.

Anyways, I tried googling the topic but was unable to find anything useful. Is there a special word for data distribution strategy? I'd like to see whats been done before, like for ext4 or ntfs.

$\endgroup$
1
$\begingroup$

Filesystems are optimized to make very slow hard disks (uneven access times, getting nearby data is much faster) perform decently. A simple way of doing this is the original Unix file system. If that is not your case, take a look at memory management strategies, perhaps including garbage collection.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.