I'm searching for the simplest and easiest way to keep two memory regions of the same size aligned.
I was hoping that the operating systems would offer an api for this, something like:
SyncMemory sync = StartSyncMemory(prt1, ptr2, size);
But it doesn't seems to be the case.
The only suggested solution I could find on the web is to mark the first region as readonly and have a write to the other region on the callback, but it seems quite slow to me, and of course I would have to deal with multithread to some extent I guess...
Do you happen to know if there's something that can do this at a os level? Something like mmap but for memory instead of files...
Another "could-do-it" solution would be vanilla mmap (yes I want to save the entire state of the game, you guessed it), but I'm talking about GB's of memory, and a lot of writes, don't know what the performances of mmap are with these sizes... Do you have any resources on that?
Thank you very much,