Memory Simulator.
Hello, I just got a project to do that involves CPU time, memory usage, total memory usage. I have to create a memory manager simulator. It has to be fast, effeceint, and bugless. Bugless means it has to work with out errors. The program will read a file that has 4 instructions:
Allocate for memory X bytes on process A
Access memory address X for process A
Deallocate memory address X from process A
End process A
To do all that, the program will have to keep track of all process and where they are allocated. Each process may allocate more than one memory block. The simulator also has to keep check for illegal memory access. If it does, it returns an access error, aka seg. fault. Don't worry about memory allocation libs, we just use the new and deletes from C++. As from time test, this is slow, but it is required. Any ideas to go about this?
The target optimized range is 100 process, preforms 400,000 operations, and uses about 100MB. (virtual memory is avoid)
I was thinking using quadric hash table starting at 50. Hash tables have fast access time and does not need to do any pointer tricks. Within the each cell of the table contain process ID, memory starting address, size, and pointer next cell. So the quadric hash table is the start of linked list that points to the next alloc.
Other options I thought of.
Splay Tree, lots of overhead and rotating is kind of slow of our need.
Linked List instead of using hash table, with 100 cells linked list seems find. But we do have a target size, so why not just hash table?
Array, just the same thing as hash table, is it not?
Allocate for memory X bytes on process A
Access memory address X for process A
Deallocate memory address X from process A
End process A
To do all that, the program will have to keep track of all process and where they are allocated. Each process may allocate more than one memory block. The simulator also has to keep check for illegal memory access. If it does, it returns an access error, aka seg. fault. Don't worry about memory allocation libs, we just use the new and deletes from C++. As from time test, this is slow, but it is required. Any ideas to go about this?
The target optimized range is 100 process, preforms 400,000 operations, and uses about 100MB. (virtual memory is avoid)
I was thinking using quadric hash table starting at 50. Hash tables have fast access time and does not need to do any pointer tricks. Within the each cell of the table contain process ID, memory starting address, size, and pointer next cell. So the quadric hash table is the start of linked list that points to the next alloc.
Other options I thought of.
Splay Tree, lots of overhead and rotating is kind of slow of our need.
Linked List instead of using hash table, with 100 cells linked list seems find. But we do have a target size, so why not just hash table?
Array, just the same thing as hash table, is it not?
