Question

I am using shared memory to pass data between processes.
They use exact memory mapping, so they can use same virtual adresses.

I want to use tbb concurent hash map between processes via shared memory
I think i need to use scalable allocator and to make it use shared memory, buy how?
I will use only simple types(int, float,fixed array size) no pointers.

I am working on linux, and in c++, i can use boost if needed.

Was it helpful?

Solution

Usually, C++ containers can be specialized via an allocator type which will override the default allocator for allocating elements and internal structures. To use a container in IPC shmem region, it must be allocated entirely inside this given region. Unfortunately, current implementation of tbb::concurrent_hash_map allocates some internal structures directly, bypassing user-specified allocator.

Thus, it is not possible to use tbb::concurrent_hash_map inside shmem region for now (though, it could be possible with few modifications to its code).

As for the scalable allocator, it can be used to allocate memory in the given region using "Scalable Memory Pools" community-preview feature, but it cannot replace standard allocator this way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top