This is a Faux-Memory simulator written by Marek Ufnal. The program imitates a contiguous computer memory and assesses the effectivnes of First Fit, Best Fit, and Worst Fit allocation strategies.
The report is available in 1DV512_Assignment1_mu222fh.pdf for further explanations.
Compilation and running was tested using clang++, as well as g++ on an Intel based MacBook Pro, as well as Kali Linux (Debian base) distribution on an Intel based Dell. These compilers are are popular and often part of the OS, but feel free to use your favourite C++ compiler. No "makefile" file is provided.
For easy compilation, all include statements are contained with the appropriate files. This includes the .h header files as well as .imp.h definition files. This enables a simple compilation using a single Main.cpp file for your convenience.
Please note, a -std=c++11 must be specified since some functions relly on C++11 for_each loop syntax and auto typing. You can build the executable using VSC's run but throws warnings since -std=c++11 doesn't seem to be specified by default. Regardless of warnings, still seems to retain full functionality.
Example terminal compilation commands for you to copy:
clang++ -std=c++11 -g Main.cpp -o Main
...or
g++ -std=c++11 Main.cpp -o Main
After compilation you can run the newly created executable. Please note the program takes one argument - the name of the simulation file:
<executable_path> <input_file_name.in>
Example usage:
./Main instructions.in
The .in file must follow the format specified in the assignment description for successful execution. That is, the file must start with a maximum memory size declaration on the first line, followed by memory instructions - one per line. All args for each instruction are semi-colon(';') separated, eg. A;1;100.
For best results, it is recommended to cd into the program directory, and placing the instruction file within the same directory. Theoretically, can be run elsewhere, but please make sure the .in file is in the appropriate directory to where the program is run.
Only one simulation file can be specified for a single execution.
Upon successful execution, you'll find a number of .out files in the same directory where the program was run containing the results.
Enjoy this amazing Faux-Memory simulator.