I've been looking at this page: https://wiki.osdev.org/User:Pancakes/Bi ... ementation. I understand the basic theory of this, I think: the heap is a linked list of memory blocks. Each block which is part of the heap has a header in the first few bytes of it, saying where the next block is, as well as some metadata. Directly following the header, there is a bitmap, where each bit represents the availability of a corresponding region of memory within this block. The size of that region of memory is configurable per block, it seems.
There are some things I don't understand about this implementation though, namely:
- Why, when initialising a new block, are the bytes in the bitmap set to 0x05?
- Other than that, am I right about my understanding of this?
Questions about Pancakes' heap implementation with bitmaps
-
- Member
- Posts: 64
- Joined: Fri Jan 26, 2018 11:43 am
Re: Questions about Pancakes' heap implementation with bitma
It looks like, though they're calling it a bitmap, it's actually being used as an array of one-byte IDs, that are used to differentiate whole allocations.j4cobgarby wrote: - Why, when initialising a new block, are the bytes in the bitmap set to 0x05?
Developing: jsix - UEFI-booted x64 kernel
-
- Member
- Posts: 64
- Joined: Fri Jan 26, 2018 11:43 am
Re: Questions about Pancakes' heap implementation with bitma
Oh, I see, do you mean by the one-byte IDs that they're the thing used to represent how long each allocation is?justinian wrote:It looks like, though they're calling it a bitmap, it's actually being used as an array of one-byte IDs, that are used to differentiate whole allocations.j4cobgarby wrote: - Why, when initialising a new block, are the bytes in the bitmap set to 0x05?
-
- Member
- Posts: 64
- Joined: Fri Jan 26, 2018 11:43 am
Re: Questions about Pancakes' heap implementation with bitma
Actually I may have just worked it out, as you said, the number in the byte distinguishes between the different allocations - got it, thanksj4cobgarby wrote:Oh, I see, do you mean by the one-byte IDs that they're the thing used to represent how long each allocation is?justinian wrote:It looks like, though they're calling it a bitmap, it's actually being used as an array of one-byte IDs, that are used to differentiate whole allocations.j4cobgarby wrote: - Why, when initialising a new block, are the bytes in the bitmap set to 0x05?