How to implement shared memory in .NET?

Update: Hey, here’s a page I just found with a compleate implmentation. Using C++/CLI, it’s quite easy to setup shared memory as per normal C++ API (C++/CLI being able to interact with the managed and native HEAP/memory references). The UnmanagedMemoryStream can then be used to expose a Stream object to C#. I did not attach … Read more

Shared memory in multiprocessing

Because this is still a very high result on google and no one else has mentioned it yet, I thought I would mention the new possibility of ‘true’ shared memory which was introduced in python version 3.8.0: https://docs.python.org/3/library/multiprocessing.shared_memory.html I have here included a small contrived example (tested on linux) where numpy arrays are used, which … Read more

How to use shared memory with Linux in C

There are two approaches: shmget and mmap. I’ll talk about mmap, since it’s more modern and flexible, but you can take a look at man shmget (or this tutorial) if you’d rather use the old-style tools. The mmap() function can be used to allocate memory buffers with highly customizable parameters to control access and permissions, … Read more