shared-memory

Boost shared_memory_object problem with types different from char...

I have a problem with boost shared_memory_object and mapped_region. I want to write a set of objects (structures) in the memory object. If the structure contains just a char, everything is ok; if I just add an int to the structure, then if I put too many objects (let's say 70, so much less than the limit of the block) I get a segmentatio...

Increase memory for shared memory

Hi there! Actually when trying to get shared memory, shmget() often fails with because being unable to allocate memory. The physical size of RAM really shouldn't be the problem (4GB is enough, I think). Rather there's probably anywhere in the systems properties a limit for allocating shared memory set. Does anyone know, where I can fin...

Shared memory and strings: managed?

I have a problem with boost::interprocess::string in shared memory. When I use a shared_memory_object I can manipulate a structure with different fields, BUT strings (I get a segmentation fault). On the other side, when I use managed_shared_memory everything is fine. Am I doing something wrong? Do you know if there is a performance...

Intermixing exe's statically compiled agaisnt different versions of a library w/ shared memory

I apologize in advance for the long-winded question but I wanted to make sure I didn't leave out any key points that may alter your response. I am responsible for maintaining system software written in 'C' of which we have a few common '.a' libraries. We have what I would call an "Execution Manager" who's main job is to fork and and ex...

Is it possible to share a C struct in shared memory between apps compiled with different compilers?

I realize that in general the C and C++ standards gives compiler writers a lot of latitude. But in particular it guarantees that POD types like C struct members have to be laid out in memory the same order that they're listed in the structs definition, and most compilers provide extensions letting you fix the alignment of members. So if ...

Listing all shared memory segments used by a process on AIX5.3+

I would like to find all shared memory segments used by a given process. I am especially interested in figuring out the shmid so i can use it in calls to shmctl(). On Solaris i would just read /proc/$PID/map to figure out that information (field pr_shmid). The contents of that file are defined by struct prmap_t in sys/procfs. AIX also ...

How to get Shared Object in Shared Memory

Our app depends on an external, 3rd party-supplied configuration (including custom driving/decision making functions) loadable as .so file. Independently, it cooperates with external CGI modules using a chunk of shared memory, where almost all of its volatile state is kept, so that the external modules can read it and modify it where ap...

shared data utilizing multiple processor in python

I have a cpu intensive code which uses a heavy dictionary as data (around 250M data). I have a multicore processor and want to utilize it so that i can run more than one task at a time. The dictionary is mostly read only and may be updated once a day. How can i write this in python without duplicating the dictionary? I understand that p...

delete all shared memory and semaphores on linux

how can i delete all NOT USED semaphores and shared memory with a single command in ubuntu?? ...

C# shared memory between C++ application and C# application using COM object

Hi Guys, Is it OK/possible to have a shared memory in a COM object which will be consumed by applications built using C# and/or C++? Can C# access shared memory in COM object without crash? Thanks, Adi Barda ...

Accessing variable in kernel-space from user-level space

Hello, So let's I have a struct that I want to read from user-level space that is defined in the kernel-space, but the user-level space has multiple processes. Example: In a kernel module, I have a global struct. struct { int a; int b; } test; In a user-level module, I have "externed" that global struct extern struct { int a; ...

System V shared memory in Python?

How can I make use of the shmat(), shmdt(), shmctl(), shmget() calls from Python? Are they hidden somewhere in the standard library? Update0 I'm after System V bindings that can be found in the Ubuntu repositories, or Python standard libraries (now or in future releases). ...

How do you efficiently debug reference count problems in shared memory?

Assume you have a reference counted object in shared memory. The reference count represents the number of processes using the object, and processes are responsible for incrementing and decrementing the count via atomic instructions, so the reference count itself is in shared memory as well (it could be a field of the object, or the objec...

Shmat with non-null shmaddr

Could someone provide an example of (reasonably) using the function shmat() with non-null second parameter? The manual says: #include <sys/shm.h> void *shmat(int shmid, const void *shmaddr, int shmflg); The shmat() function attaches the shared memory segment associated with the shared memory identifier shmid to the data se...

Is this a safe way to share read-only memory with child processes?

I want to allocate and initialise a fairly large chunk of contiguous memory (~1GB), then mark it as read-only and fork multiple (say several dozen) child processes which will use it, without making their own copies of the memory (the machine won't have enough memory for this). Am I right in thinking that if I malloc the memory as usual,...

Should access to a shared resource be locked by a parent thread before spawning a child thread that accesses it?

If I have the following psuedocode: sharedVariable = somevalue; CreateThread(threadWhichUsesSharedVariable); Is it theoretically possible for a multicore CPU to execute code in threadWhichUsesSharedVariable() which reads the value of sharedVariable before the parent thread writes to it? For full theoretical avoidance of even the remote...

Changing existing shared memory segment size

Hi. I have some legacy code that uses shmget/shmat/shmdt to create, attach and manage shared memory segments. The app with the code sometimes crashes, leaving the segments in memory. The code re-uses same segment key to reconnect to them, but the problem it uses different shared memory sizes every time, and unable to connect because of...

Posix shared memory vs mapped files

Hi. Having learnt a bit about the subject, can anyone tell, what is the real difference between POSIX shared memory (shm_open) and POSIX mapped files (mmap)? Both seems to use the /dev/tmpfs subsystem, rather then older IPC mechanism. So is there any advantage of using mmap file over shared memory? Thanks. ...

Shared Memory Bank Conflicts in CUDA: How memory is aligned to banks

As far as my understanding goes, shared memory is divided into banks and accesses by multiple threads to a single data element within the same bank will cause a conflict (or broadcast). At the moment I allocate a fairly large array which conceptually represents several pairs of two matrices: __shared__ float A[34*N] Where N is the nu...

STL Structures in Static Memory 'Losing' Data Across Threads

Hey all - I'm writing a multi-threaded demo program using pthreads, where one thread loads data into an STL queue, and another thread reads from it. Sounds trivial, right? Unfortunately, data pushed into the queue is vanishing. I'm not new to multithreading, nor am I unfamiliar with memory structures - however, this has me stumped. ...