I try to make a couple of programs that work with shared memory (Server and client) in Ubuntu, for Windows I have found that you can create shared memory in the following way and it works well.
int BUF_SIZE = sizeof(Message) * 2;
string sharedName = "Global\MyFileMappingObject";
string message = "";
HANDLE hMapFile;
hMapFile = CreateFileMapping(
INVALID_HANDLE_VALUE, // use paging file
NULL, // default security
PAGE_READWRITE, // read/write access
0, // maximum object size (high-order DWORD)
BUF_SIZE, // maximum object size (low-order DWORD)
sharedName.c_str() // name of mapping object
);
However for Ubuntu I have not found the correspondence of this function that does the same as in Windows.