my kmalloc implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have to write my own kmalloc.
I am not given any sort of Kernel API to assign or delete memory.
Suppose I have 4GB of memory on Ram.
Some of which is filled and some of which is not filled.
My question is what data structure do I need to maintain in order to be able to assign memory 
to any userspace program when the program requests some bytes of memory which can be 1 or 
more.
My logic for this implementation was to maintain a hashtable.

For example
1------> points to all the memory addresses which are 1 byte and free 
2------> points to all the memory addresses which are 2 byte and free 
3------> points to all the memory addresses which are 3 byte and free 
4------> points to all the memory addresses which are 4 byte and free 
.
.
.
.
.
.
.
n------> points to all the memory addresses which are n byte and free 

How can I improve the above schema because to know the location where 1byte memory is free
I will maintain a pointer which can be u64 or u32 which itself is costlier than the free memory itself.
So what should I be doing to be able to do above.

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux