"Marven Lee" <
marv...@gmail.com> wrote in message
news:auu6uq...@mid.individual.net...
> My microkernel allocates memory as contiguous spans of
> physical memory in a similar way to segments but using spans of
> physically contiguous pages. I'm doing it this way as the
> message passing revolves around unmapping these segments from
> one process and then mapping them into another. A small header
> of upto 128 bytes can also be copied with the main body of the
> message.
>
...
> But I was thinking of modifying how I allocate and compact
> these segments. I was also thinking that I could have a
> background task that wakes up every few minutes or so and
> compacts the segments downwards.
>
What is the need for the compaction?
E.g., reduce fragmentation, coalesce the memory pool, limited
memory or out-of-memory issues, imperfect re-use of
de-allocations, lack of virtual memory, ...
I.e., I'd assume that if re-use of de-allocations was working
well, then you wouldn't need to compact memory. There would
be a good fit between former allocations and currently needed
allocations.
> To manage these physical segments I currently use a quick-fit
> allocator with 64 lookaside lists for allocations from 4k to
> 256k. Allocations larger than 256k are on a separate list.
> The best fitting segment is chosen and split if necessary.
>
Do these fit well? Do these re-use well?
Can over-allocation reduce re-use issues?
(e.g., round-up, limited set of allocation sizes, etc.)
By "split if necessary", you're referring to splitting the
_segment_ for allocations less than (undersized) the "best fitting
segment" in size, yes? Or, do you mean splitting the _allocation_
for allocations larger than (oversized) the "best fitting segment"
in size? Splitting the segment is fine, but may make it harder to
find larger blocks to re-use. Could this be a factor in your
desire to compact reclaimed memory? I.e., are you repeatedly
breaking memory allocations into smaller and smaller parts? FYI,
you definately want to avoid splitting the allocation. It will
cause serious problems with HLL's like C. They expect memory
allocations to be contiguous since they reference allocations by a
single address.
...
Rod Pemberton
P.S. If you're replying from comp.arch, please leave a.o.d. on.