This is related to a previous post:
Allocating a large memory block in C++
I would like a single C++ server running that generates a giant matrix M
. Then, on the same machine I would like to run other programs that can contact this server, and get the memory address for M
. M
is read only, and the server creates it once. I should be able to spawn a client ./test
and this programs should be able to make read only access to M
. The server should always be running, but I can run other programs like ./test
at anytime.
I don't know much about C++ or OS, what is the best way to do this? Should I use POSIX threads? The matrix is a primitive type (double
, float
etc), and all programs know its dimensions. The client programs require the entire matrix, so I don't want latency from mem copy from the server to the client, I just want to share that pointer directly. What are my best options?