MIPS Dynamic Memory Management Project/Report

*Please see attached document for the report template with greater detail about each required component of the project.


Description of the Project (Dynamic Memory Allocation)

Most modern programming languages such as C, C++, and Java provide the programmers a facility to request memory of any size (sufficient to store a data structure or an object) from the operating system dynamically at execution time using system calls “malloc” or “new.” The operating system allocates the requested memory from a pool, and restores it back to the pool, when the user returns the earlier requested memory using system calls “dealloc” or “free.” You may note that this type of memory allocation is different from static allocation at compile/load time for different fixed size data structures such as arrays.

In this project, you are required to develop a software subsystem for dynamic allocation of memory and implement it in MIPS assembly language. The main program of your code keeps on waiting in a loop for user’s request through console for allocation/deallocation of memory of a size for a variable with a name, and calls allocation or deallocation procedure accordingly. The allocation procedure allocates an available chunk of memory (that is, one not allocated to another variable), and updates an availability list that indicates which portions of memory are allocated and which are free. The new variable is also put in an available row of a table called symbol table along with the information about range of chunks allocated to the variable. When a deallocation request comes from the user, the deallocation procedure is invoked. This procedure updates the availability list by marking the chunks allocated to the variable as free (free for allocation to another variable in a forthcoming allocation request). The symbol table entry corresponding to this variable is also deleted. The allocation and deallocation requests may come in any order, and a possible complication your project needs to handle is the scenario where there may not be enough contiguous memory required for the new variable though the free memory from disjoint chunks may total up to a value higher than the requested amount. For easier design and testing, you may make the following simplifying assumptions:

  1. The pool of memory is very limited, say 2048 bytes
  2. The pool is partitioned into small chunks of equal size (say, 32 bytes each so that in a pool of 2048 bytes, there will be 64 chunks).
  3. Though the memory requests could come for any size, allocation is always done in the integral number of chunks. That is, if a request for 100 bytes is made, 128 bytes (or 4 chunks) are allocated.

Ideas for DesignYou need to have a symbol table or a mapping of memory variables and the range of the numbers of chunks allocated. You also need to have a free/availability list, a Boolean array indicated the free and allocated chunks (1 for allocated and 0 for free chunks). Initially, all entries in free list are marked zero (i.e. free). All symbol table entries are also initialized to be available possibly by setting an availability flag to zero.


*Please see attached document for the report template with greater detail about each required component of the project.

Get Help With a similar task to - MIPS Dynamic Memory Management Project/Report

Login to view and/or buy answers.. or post an answer
Additional Instructions:

Dynamic Memory Management Table of Contents Abstract 2 1. Requirement Specification 3 2. Functional Specification 3 3. Design Specification 4 4. Implementation 5 5. Testing 9 6. Conclusion 9 Abstract This project, a program that mimics the Operating System capability to allocate and deallocate user-specified bytes of memory dynamically to program variables under some simplifying assumptions as follows: · The memory pool is limited and in the region of 2048 bytes · The memory pool divided into equal chunks of 32 bytes (chosen due to MIPS architecture) which renders 64 chunks in 2048 bytes · Despite allocation requests coming in any size, the actual allocations should be performed in integer multiples of chunks. Therefore, the byte size request will be rounded up to the closest multiple of 32. · To succeed in this task, the code must allocate and deallocate memory upon request. If some of the requests cannot be handled, exception handling must activate to resolve the issue. 1. Requirement Specification Item Number Requirement Description Comments 1 Memory Allocation Allocate the user-specified amount .. 2 Memory Deallocation Clear the block reserved under the user-specified variable name 3 Write the program in MIPS Assembly Language Table 1: Requirement Specification 2. Functional Specification To aid in the design as well as recovery from shortcomings, it is beneficial to delineate some scenarios in which the program will have to respond specifically. These are broken into success and failure scenarios. Success: The program performs the following 1. The program successfully allocates the user-specified memory to the user-specified variable name 2. The program successfully deallocates the memory associated with the user-specified variable name Failure: The program prints the appropriate error messages given the following conditions 1. The response to the allocation/deallocation prompt is incorrect. 2. The symbol table has no room left. 3. In the allocation method, the variable name given by the user is already defined. 4. There isn’t enough free, contiguous memory left to fulfill an allocation request. 5. In the deallocation method, the variable name given by the user cannot be found in the symbol table. 3. Design Specification There will be a main program that indefinitely waits in a loop for a user’s memory management request in console. The user will decide whether to allocate memory, of a size of their choice for a variable name of their choice, or to deallocate memory currently reserved by the variable name they supply. The allocation method allocates free chunks of memory and then updates the table to indicate which chunks are reserved and which are free. The deallocation method searches for and then designates as free the memory blocks previously reserved for a given variable name. Allocation and deallocation requests may come in any order. A possible issue that must be handled is the possible case where not enough contiguous memory is available for a given allocation request. The following simplifying assumptions are made: · The memory pool is limited and in the region of 2048 bytes · The memory pool divided into equal chunks of 32 bytes (chosen due to MIPS architecture) which renders 64 chunks in 2048 bytes · Despite allocation requests coming in any size, the actual allocations should be performed in integer multiples of chunks. Therefore, the byte size request will be rounded up to the closest multiple of 32. FLOW CHART and Explanation should follow. Figure 1: Flow Chart for Dynamic Memory Management 4. Implementation Self-documented MIPS Code HERE with additional comments as needed. 5. Testing Test Plans and Test Scripts for testing various scenarios here. Test Case Example Aim- what are you testing? Setup Procedure Result – success or fail cleanup to original state 6. Results Figure 2: Console Display During Testing Phase 7. Conclusion and Future Extensions Dynamic memory management is considered a difficult task even in high level languages such as C. It is even more so in MIPS assembly, but understanding how the process works at a foundational level is quite important. The creation of this program started from the broadest scope and narrowed it until a clearer picture of what was needed appeared. It started with defining what exactly the program needed to do using functional and requirement specifications. Then the flow chart gives a visualization of how it should behave at each step. Then the program is written, compiled and tested. This project expounded on the fundamental and crucial practice of memory management. Every digital system has to deal with this process. Learning how to do this dynamically with the given constraints is especially beneficial for when memory is scarce, such as in embedded systems. REFERENCES Acknowledgments

Related Questions

Similar orders to MIPS Dynamic Memory Management Project/Report
94
Views
0
Answers
MIPS assignment
MIPS coding assignment, can send template...
145
Views
0
Answers
MIPS assignment
Follow the instructions, can email template to you...
113
Views
0
Answers
MIPS homework assignment
I will write it in my own hand writing later you just need to type it out, steps need to be shown for this assignment....
161
Views
1
Answers
MIPS homework assignment
No need to wrtie it in hand writing, i will do that myself afterwards. Need to put steps though....