shared-memory

Creating accessing shared memory in C.

So I have a problem that I don't really know how to go about. I was hoping maybe you could let me know how to deal with it. I need to allocate N number of buffers in shared memory. Each buffer should be initialized to 0. Then I must fork N/2 number of child processes. Each child(i) then writes value (i) into buffer (i), sleeps for one...

How does one keep an int and an array in shared memory in C?

I'm attempting to write a program in which children processes communicate with each other on Linux. These processes are all created from the same program and as such they share code. I need them to have access to two integer variables as well as an integer array. I have no idea how shared memory works and every resource I've searched ...

How to combine Pool.map with Array (shared memory) in Python multiprocessing?

I have a very large (read only) array of data that I want to be processed by multiple processes in parallel. I like the Pool.map function and would like to use it to calculate functions on that data in parallel. I saw that one can use the Value or Array class to use shared memory data between processes. But when I try to use this I get...

message queue. msgsend msgrcv. System V IPC system calls in C (Linux)

Hi I'm working with some shared memory where different processes read and write data. I'm using a message queue to store messages of when data has changed between read and write operations. /* struct that defines a message */ struct msgbuf{ long mtype; /* must be positive */ int childId; //ID of child sending message ...

IPC message queue. msgrcv system call. System V. how to get out of loop.

Hi, I have a message queue from which I am getting messages in a loop. The problem is that I don't know how to exit the loop. msgrcv returns type size_t so it keeps going. What value should I compare the return value so I can exit the loop? while(msgrcv(msqid, &msgreceived, sizeof(msgreceived), BUFFER_CHANGED, 0) != -1){ printf("%d %d ...

Does PHP copy variables when retrieving from shared memory?

If I run an shm_get_var(), will it return a "reference", keeping the data in shared memory? I'm wanting to keep an array about 50MB in size in shared memory so that it can be used by multiple processes without having to keep multiple copies of this 50MB array hanging around. If shared memory isn't the answer, does anyone have another id...

Is there a way to determine if free() would fail?

Is there a way to determine if free() would fail if ever called on a certain memory block pointer? I have the following situation: a thread having access to a shared resource fails whilst it may have been in the state of freeing the said resource. Now I need to devise a safe way to clean-up this shared resource. Of course I have assig...

Mutex in shared memory

Suppose a process is creating a mutex in shared memory and locking it and dumps core. Now in another process how do i ensure that mutex is already locked but not owned by any process? ...

Shared memory vs. Go channel communication

One of Go's slogans is Do not communicate by sharing memory; instead, share memory by communicating. I am wondering whether Go allows two different Go-compiled binaries running on the same machine to communicate with one another (i.e. client-server), and how fast that would be in comparison to boost::interprocess in C++? All the example...

Can address space be recycled for multiple calls to MapViewOfFileEx without chance of failure?

Consider a complex, memory hungry, multi threaded application running within a 32bit address space on windows XP. Certain operations require n large buffers of fixed size, where only one buffer needs to be accessed at a time. The application uses a pattern where some address space the size of one buffer is reserved early and is used to...

How to query a variable in another running application in c#?

I have an app that, when launched, checks for duplicate processes of itself. That part I have right - but what I need is to check a state variable in the original running process in order to run some logic. So: how do I make a variable (e.g. bool) available publicly to other applications so they can query it? ...

What's the difference between the message passing and shared memory concurrency models?

Correct me if I'm wrong, but I'm surprised this hasn't been asked before on here ... ...

C++ : When do I need a shared memory allocator for std::vector?

First_Layer I have a win32 dll written in VC++6 service pack 6. Let's call this dll as FirstLayer. I do not have access to FirstLayer's source code but I need to call it from managed code. The problem is that FirstLayer makes heavy use of std::vector and std::string as function arguments and there is no way of marshaling these types int...

64 bit shared memory segment C \ linux problems

Hi, I'm looking to do some IPC with shared memory segments in C \ Linux. I go on creating it like normal : typedef struct { int a[2]; } shm_segment; ... shm_segment *shm; int shm_id; int shm_flags = IPC_CREAT | 0666 int shm_size = sizeof(struct shm_segment) key_t key = 88899; shm_id = shmget(key, shm_size, shm_flags); // ies t...

How might i do these IPC techinques?

I remember back in the day while using C and win32 i had a number of IPC techniques. So far i haven't ran into any of them in .NET or seen them outside of C so i thought i ask how might i do these inter-process communication techniques? Shared/Global memory. Simply allocate ram that can be change by another process without any signal. ...

What is the preferred method of passing data between a service and an application

Possible Duplicate: Delphi 2009: How to communicate between Windows service & desktop application under Vista? I have a server running as a Windows service. To control the service and to display it's state I have an application running as a tray icon. I would like to pass data (log strings) from the service to the application. ...

Instantiating objects in shared memory C++

We have a need for multiple programs to call functions in a common library. The library functions access and update a common global memory. Each program’s function calls need to see this common global memory. That is one function call needs to see the updates of any prior function call even if called from another program. For compatibili...

Is it possible to allocate a 2D array as shared memory with IPC?

I want to allocate shared memory as a 2D array using IPC. I tried the following: id_shmem = shmget(ipc_key, sizeof(int)*rows*columns, IPC_CREAT|0666); matrix = (int **)shmat(id_shmem, 0, 0); The problem is that whenever I try to write something into the matrix, I get a segment fault. ...

C or C++ - dynamically growing/shrinking disk backed shared memory

I have several fastcgi processes that are supposed to share data. The data is bound to a session (a unique session id string) and should be able to survive a server reboot. Depending on the number of sessions, the shared data might be too big to fit into main memory. Ideally, in the case when the shared data exceeds a certain treshold, t...

shared memory, MPI and queuing systems

My unix/windows C++ app is already parallelized using MPI: the job is splitted in N cpus and each chunk is executed in parallel, quite efficient, very good speed scaling, the job is done right. But some of the data is repeated in each process, and for technical reasons this data cannot be easily splitted over MPI (...). For example: 5...