2 ms·
I ran into this problem many years ago when writing a memory allocator. Say you keep a list of free blocks. You don't keep them sorted, but you do keep track of
by dreamcompiler 9y ago
I ran into this problem many years ago when writing a memory allocator. Say you keep a list of free blocks. You don't keep them sorted, but you do keep track of how long the list is. You now need to find a block of at least size n but not much larger, and the free list is so long you'd rather not look through the whole thing for each allocation.
There are a bunch of ways to write memory allocators, but with the above constraints, it's the same problem.
- gnulinux 9y agoYou can use this idea in the clock algorithm to approximate LRU.