Hi, I'm dealing with some IPC (inter-process communication) with two separate C# programs, and it's my first dive into multithreading.
I'm using MemoryMappedFile for this and, based on my testing, it would be incredibly unlikely for one process to write a 'long' and for the other process to read that long incorrectly, but I'm curious whether it's also just impossible.
My main concerns (I read some articles on multithreading and now I'm really scared about what I'm getting into):
1. 4 byte read/writes are atomic, but 8 byte read/writes are not guaranteed to be atomic?
2. Even if I write a 4 byte value, if it's not aligned properly, it won't be atomic (how can I prevent this/is this even possible?)
Right now I am using a mutex to (probably) solve all these issues, but I still wonder about this.
Thanks!