I am trying to divide the shared memory into multiple blocks in such a way that
writer thread1 should write into first block of shared memory and another thread reader thread1 should read and modify the date by referring to a particular block of shared memory
Attempt which I made:
I have created a structure as follows and using that structure pointer trying to write some data into shared memory, and with another structure pointer variable I am trying to read the data. But both the reader and writer failing and the reason is not known to me. Please provide me some input on this
Please see the writer.c file and reader.c file in the attachment.
I am trying pass one more variable to reader and writer functions in reader and writer file but this also fails, as of now I am passing only one variable to these functions as parameters.
What I am trying to attempt:
void *reader(void *);
void *writer(void *);
If I am able to pass two variables to both these function then other variable I can use as a file pointer and hopefully that may sort out the problem, but this also gives me strange kind of error. This is what I am trying to do
But when I tried this I couldn't succeed... Please give some on this also.
void *reader(void *, void *);
void *writer(void *, void *);
P.S-: I have attached the code (shmem.zip), please have a look at it.