Re: fragmentation
- From: Gene <gene.ressler@xxxxxxxxx>
- Date: 28 May 2007 14:15:02 -0700
On May 28, 4:04 am, drop...@xxxxxxxxx wrote:
Hi.
I'm writting my own memory management functions.
While playing with different options, I feel necessity of
fragmentation counting algorithm.
For example, 1 is allocated block and 0 is not.
This is 0% fragmentation: 11111100000
This is 100% fragmentation: 101010101010
How can I build algorithm which will count this coefficient?
You are looking for a heurisitic indicator, so there is no single
answer.
Richard Heathfield gave a useful one. The fraction of block-block
boundaries that separate free and allocated space (minus one) with
respect to total number of block-block boundaries. This is allocator-
centric, since it uses only blocks in its computation, igoring that
allocations are usually multiple blocks.
So give the name _segment_ to any set of blocks allocated by a call of
the allocator.
Then another useful metric is the number of segment boundaries that
touch free space (minus one) divided by the total number of segment
boundaries. This tells you how successful the allocator has been in
matching requests to the size of available "holes."
Another possibility is the number of free blocks that are smaller than
the median (or mean or mode or whatever makes sense) size allocated
segment divided by the total number of free blocks. This is an
indicator of "wasted" space, i.e. the space likely to be in segments
too smal to be useful.
Yet another is the number of blocks (or segments) that would have to
be moved by a given compaction algorithm to obtain fully contiguous
allocation divided by the total number of blocks(or segments)
allocated. This is an indicator of future computing power needed to
fix the fragmentation.
You get the idea. Pick what best suits your needs for information
about how well the allocator is performing.
.
- References:
- fragmentation
- From: drop669
- fragmentation
- Prev by Date: Re: Web vs. Desktop based systems
- Next by Date: Re: Data structure for fast associative array with lookup by both key and index
- Previous by thread: Re: fragmentation
- Next by thread: Re: Schools working to overhaul the art of computer programming (The Columbian)
- Index(es):
Relevant Pages
|