Why use buddy algorithm?
From: Oliver (oliver.news_at_t-link.de)
Date: 07/30/03
- Next message: Pete Zaitcev: "Re: Why use buddy algorithm?"
- Previous message: Robert Vazan: "Re: Q: Linux system capacities on data structures."
- Next in thread: Pete Zaitcev: "Re: Why use buddy algorithm?"
- Reply: Pete Zaitcev: "Re: Why use buddy algorithm?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Jul 2003 10:42:53 -0700
Hello,
I have a basic question about the memory management, not only in linux
but generally.
I read somewhere on the Net that Linux uses the buddy algorithm for
the physical memory management. So I conclude it has some advantage
over other methods. I understand how the buddy system works. But I
don't understand the advantage.
Let me try to make this clear.
What is the point contra my suggestion: In a virtual address space the
only and smallest parts of memory one has to manage are pages frames.
So I could use a list of all free page frames. This list has not to be
sorted in any way. If a process wants memory of one page, I take the
first entry, update the process' page table and return the new page
address in its process address space it can use from now on. If a
process needs more than one page I do the same but remove the first
entry as often as the number of pages it needs is. Then I have to
update the page table so that for the process all page frames seem to
be neighbours.
So far I have no disadvantage over the buddy algorithm?
If one page is freed, I take the entry back in my list in any position
for example the first. If more pages are freed I guess free() has to
handle the single pages. But it's the same for each page frame.
I see the advantage of the buddy alg. if you have different sizes of
memory that are allocated. And I also see that malloc() can use it to
manage the space inside one page, but I don't get the point for the
virtual address space management.
Perhaps someone can help me with that.
Oliver
- Next message: Pete Zaitcev: "Re: Why use buddy algorithm?"
- Previous message: Robert Vazan: "Re: Q: Linux system capacities on data structures."
- Next in thread: Pete Zaitcev: "Re: Why use buddy algorithm?"
- Reply: Pete Zaitcev: "Re: Why use buddy algorithm?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|