I have seen that there are several kernel heap algorithms with their pros and cons. What about Linux? What is the heap algorithm that the Linux Kernel is using?
Thanks for your answers
What heap algorithm is Linux using?
Re: What heap algorithm is Linux using?
If only the source code wad available to answer this sort of question.
If only someone had written a book describing the workings of the Linux kernel.
Seriously - without wishing to appear rude - there is a wealth of information available on the web and in print about the Linux kernel. You will learn far more by doing your own research than by asking someone else to do it for you. Amongst other publications let me recommend: https://www.amazon.com/Professional-Ker ... 0470343435
If only someone had written a book describing the workings of the Linux kernel.
Seriously - without wishing to appear rude - there is a wealth of information available on the web and in print about the Linux kernel. You will learn far more by doing your own research than by asking someone else to do it for you. Amongst other publications let me recommend: https://www.amazon.com/Professional-Ker ... 0470343435
Re: What heap algorithm is Linux using?
Hi
https://www.kernel.org/doc/gorman/html/ ... nd009.html
https://en.wikipedia.org/wiki/Buddy_memory_allocation
https://www.kernel.org/doc/gorman/html/ ... nd011.html
https://en.wikipedia.org/wiki/Slab_allocation
Cheers,
bzt
A quick google search reveals that Linux is using the buddy allocator for page allocation and slab allocator for heap, which algorithm originates from Solaris' allocator.LIC wrote:I have seen that there are several kernel heap algorithms with their pros and cons. What about Linux? What is the heap algorithm that the Linux Kernel is using?
Thanks for your answers
https://www.kernel.org/doc/gorman/html/ ... nd009.html
https://en.wikipedia.org/wiki/Buddy_memory_allocation
https://www.kernel.org/doc/gorman/html/ ... nd011.html
https://en.wikipedia.org/wiki/Slab_allocation
Cheers,
bzt
Re: What heap algorithm is Linux using?
Source code tells you lots about the "how". Unless there are comments, figuring out the "what" can be somewhat of a stretch, especially in a code base of that magnitude. And even then you usually get the "what" on a rather too-fine-grained level. Usually we rely on documentation to tell us the high-level "what" and "why".iansjack wrote:If only the source code wad available to answer this sort of question.
Every good solution is obvious once you've found it.
Re: What heap algorithm is Linux using?
Which - of course - is why I also recommended books.Solar wrote:Source code tells you lots about the "how". Unless there are comments, figuring out the "what" can be somewhat of a stretch, especially in a code base of that magnitude. And even then you usually get the "what" on a rather too-fine-grained level. Usually we rely on documentation to tell us the high-level "what" and "why".iansjack wrote:If only the source code wad available to answer this sort of question.
A combination of the two is - IMO - better than relying upon inaccurate generalisations such as " it uses the buddy allocator".
Re: What heap algorithm is Linux using?
Thank you for your replies, I tried to check the answer by myself with the Linux kernel code but with all the files, I could not find out a clue on where to look for this part of the kernel first.
Thank you for the links !
Thank you for the links !