I have 2 applications running on my linux box, a server and a client. My server and client examples I am working with is from Dave Marshalls examples. Everything works well, but when I try this in my background process and I want to extend my original segment (perhaps due to an application upgrade in the future) I either have
Tag: shared-memory
Putting a Struct into Shared Memory
I have created two programs a server.c and a client.c. I have a struct that holds an age. I have got the programs working together to read the shared memory and to change the shared memory, however this only works when using one variable in the struct. As soon as i have more than one variable in the struct i
Working with semaphores and shared memory under Linux
I need to write a program that is creating a N amount of sub processes and every single one of them adds one to a shared memory variable. My idea is to use semaphores and shared memory, but the processes are not waiting for each other and the shared memory variable is also not working as I want it. mydefs.h
Playing with shmat and shm_open
I just read the manpages for shm_open and shmat and was trying out the following example. In a file test.c I do, And in a wrapper file I do, I tried adding in a strerror(errno) at test.c and I get Identifier removed. What does that mean? What am I doing wrong? Given a shared memory identifier(shmid), shouldn’t I be able
A simple C++ shared memory program written on linux: segmentation fault
I got the code from a tutorial on shared memory. It worked until I defined struct LOCK and tried to write LOCKs instead of char* into the shared memory. Could someone please help me figure out the problem here that causes the segmentation fault? Answer You are placing vectors and strings into shared memory. Both those classes allocate memory of
Sharing memory between processes through the use of mmap()
I’m in Linux 2.6. I have an environment where 2 processes simulate (using shared memory) the exchange of data through a simple implementation of the message passing mode. I have a client process (forked from the parent, which is the server) which writes a struct(message) to a memory mapped region created (after the fork) with: message *m = mmap(NULL, sizeof(message),