C++ Buddy System Representation Using Array of Integers
<p>For a project from class, we are supposed to emulate memory management by using an array of integers and either singly/doubly linked lists or the buddy system. I chose to try and create a buddy system, but I'm afraid I lack allot of knowledge on how they are implemented, and I haven't been able to find any good resources on a basic step-by-step on the theory and application. The Wiki page made little sense.</p>

<p>This is how I figured I would calculate the size needed for each buddy. If the user asked for 1000 bytes, it would find the next highest 2^X number of bytes.</p>

<pre><code>    double y = 2;
    for (double x = 1, y = 2; y &lt;= bytes; x++)
        y = pow(2, x);
</code></pre>

<p>After that, though, I'm lost.</p>

<p>So I have a few questions:</p>

<ol>
<li>Am I biting off more than I can chew with the buddy system as my first attempt at basic memory management?</li>
<li>Are there any good step-by-step resources on the buddy-system and C++?</li>
</ol>
