I have been looking for this in the last two weeks, and I have not received any response. This is what I have:
The parent process that creates the myStruct structure, which is basically a linked list using pointers (if this is a serious problem, I can accept using a fixed-size array instead).
A fixed number of child processes created using fork() that need read / write access to the structure (or array) created by the parent.
I do not know how to do this to make the exchange of the myStruct variable between processes.
I tried to solve the problem using SICV IPC functions like shmget() , shmat() etc. to allocate my variable in shared memory, but I don't know how to work with void memory pointers to read / write values โโin myStruct.
Ideally, I would like to be able to use dot notation (myStruct.node)->attribute = value in each process, without dealing with pointers, since I don't know how my structure is organized into memory.
Is it possible? Could some of you help? Any help is REALLY appreciated.
In addition, I know that using threads, pipes, sockets, or similar things would be much easier, but this work is for academic purposes, for which I must imitate the presence of several independent processes.
source share