On Tue, Sep 28, 2010 at 11:59 AM, Dave Hylands <[email protected]> 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 http://www.google.co.in/search?sourceid=chrome&client=ubuntu&channel=cs&ie=UTF-8&q=index+free+list 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 <[email protected]> wrote: >I would start by reading how it is already done...is that cheating. >http://lxr.free-electrons.com/source/mm/page_alloc.c 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 <[email protected]> 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.
