Should I use multithreading for sending messages?

Started by
11 comments, last by nfries88 8 years ago
If you have lots of static data, that problem can be solved.
If the rooms are all spawned by the same parent process, you'd load the read-only data in the parent process before forking the child rooms. The OS will then map that data as copy-on-write, so it's actually shared between the child processes.
(Or you could do it manually with shared memory and/or file mapping, if you're an experienced systems programming engineer :-)

Yes, each room needs to be somehow coordinated with the matchmaker.
enum Bool { True, False, FileNotFound };
Advertisement

If the rooms are all spawned by the same parent process, you'd load the read-only data in the parent process before forking the child rooms. The OS will then map that data as copy-on-write, so it's actually shared between the child processes.

Something tells me I have some reading to do. Thanks though, I didn't realize this was possible. The independent process method is probably the way to go then for maximum safety once I figure out how to do this memory sharing in C#. That parent process also would provide a single point of contact for matchmaking and RCON.

It sounds like you're doing a lot of "empty work" -- you mentioned that you serialize an int into 4 bytes, but an int is already 4 bytes! Unless the protocol specifies some weird way of passing integers, or requires a different endianness than your machine, there's really no serialization necessary there.

This topic is closed to new replies.

Advertisement