On Tue, Sep 28, 2010 at 11:59 AM, Dave Hylands <dhylands@xxxxxxxxx> wrote:
Hi Bond,
>So user mode programs don't allocate memory using kmalloc. I believe
>that they wind up calling __get_free_pages.
>There are many data structures that can be used. The kernel provides 3
>different implementations of kmalloc, called, slab, slub and slob. It
>all depends on you design criteria.
>The simplest is to maintain a linked list of free spaces. It's simple,
>but suffers performance issues and fragmentation issues.
>You could use a bitmap (one bit per byte). Or you could maintain a
>indexed free list, where an 8-bit index is used.
I googled above thing
but indexed free list I could not find any where.
Can you give some link to what you are referring to.
>The 8-bit index would
>be stored using the free memory itself. You'd need to have a separate
>list for every 256 bytes, but that would have very low overhead.
On Tue, Sep 28, 2010 at 12:15 PM, John Mahoney <jmahoney@xxxxxxxx> wrote:
>I would start by reading how it is already done...is that cheating.
I am not that competent that I could understand that code which is given on that link.
Before posting here I had looked that link.I want to understand what data structure or
mechanism is used to do that.So once I get that thing with a simple program I surely will
finish that link which you also pointed out.
On Tue, Sep 28, 2010 at 12:15 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote:
>Bond,
>You might want to look at the example of malloc at the end of KnR.
Can you tell me which page or chapter you are referring to?
I was not able to find or missed what you suggested.