Skip to content
Snippets Groups Projects
Commit 9eba5f40 authored by j2-mcdaid's avatar j2-mcdaid :skull_crossbones:
Browse files

Update READme.md

parent b47e3383
No related branches found
No related tags found
No related merge requests found
...@@ -8,5 +8,35 @@ Task 1 required the construction of a bump allocator. This is a basic design and ...@@ -8,5 +8,35 @@ Task 1 required the construction of a bump allocator. This is a basic design and
In this case the class design is relatively simple as the class only neeeds a handfull of attributes and methods. The attributes needed govern the start point and size of the heap, as well as the "next" pointer and the allocator count. The methods are almost as simple with standard destructor and constructor, with the allocator and deallocator being slightly more involved. The header file has been used to declare the attributes and methods while the methods have been defined within the allocator.cpp file. This follows convention and makes the code more parseable.<br/> In this case the class design is relatively simple as the class only neeeds a handfull of attributes and methods. The attributes needed govern the start point and size of the heap, as well as the "next" pointer and the allocator count. The methods are almost as simple with standard destructor and constructor, with the allocator and deallocator being slightly more involved. The header file has been used to declare the attributes and methods while the methods have been defined within the allocator.cpp file. This follows convention and makes the code more parseable.<br/>
Allocator.hpp:<br/> Allocator.hpp:<br/>
![Allocator.hpp](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_bAllocator_class.png "Allocator.hpp")<br/> ![Allocator.hpp](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_bAllocator_class.png "Allocator.hpp")<br/>
Allocator.cpp:</br> Allocator.cpp:<br/>
![Allocator.cpp](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_bAllocator_define.png "Allocator.cpp")<br/> ![Allocator.cpp](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_bAllocator_define.png "Allocator.cpp")<br/>
<h3>Step 2 - Allocator</h3>
The allocator is in a template file in order to ensure type-safe allocations. It works through a couple of simple step; calculating memory needed, checking that there is enough memory, allocating the memory and incrementing the allocater counter.<br/>
Allocator:<br/>
![Allocator.tpp](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_allocator_tpp.png "Allocator.hpp")<br/>
<h3>Step 3 - Testing</h3>
There were several test needed to demonstrate certain functionality within the allocator. These were implemented within a basic user interface so that when ran the functionality could be chosen. It was implemented like this to ease testing and make the results more visually coherent. The code has not been proofed against incorrect user entry as it only serves as an example of functionality rather than as a program aimed to be used regularly.<br/>
![While Loop](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_main_while.png "While loop")<br/>
![While terminal](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_main_while_terminal.png "While terminal)<br/>
<h5>Example 1 - Integer allocation</h5>
Integer allocation is one of the simplest functionalities of an allocater. <br/>
Code:<br/>
![Integer test](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_test1.png "Integer results)<br/>
This gives the results below when ran:<br/>
![Integer result](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_result1.png "Integer result")<br/>
<h5> Example 2 - Double allocation</h5>
Double allocation shows that the allocater can handle multiple data types.<br/>
Code:<br/>
![Double test](https://gitlab.uwe.ac.uk/j2-mcdaid/advanced-systems-programming/-/raw/main/Worksheets/Worksheet2/images/task1_test2.png "Double test")<br/>
This gives the results below when ran:<br/>
![Double result]()<br/>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment