[Lab 1] shared memory synchronization
Verfasst: 8. Nov 2013 19:11
Hi,
We are currently experiencing strange behaviour regarding Exercise 4 of the 1st lab assignment:
After opening the shared memory and truncating it, we fork a second process. The child mmaps the shared memory, writes to it and munmaps it again. The parent waits for the child to exit, mmaps the shared mem itself, reads from it and munmaps it again. This approach, however, succeeds only in some cases. The reading process fails to obtain any content from shared mem in many cases.
Are we misssing some important step here? Or is the write operation to the mmaped shared mem an asynchronous write? Adding a sleep() in the parent seems to solve the problem, after 100 msec the reading always succeeds.
Thanks in advance.
We are currently experiencing strange behaviour regarding Exercise 4 of the 1st lab assignment:
After opening the shared memory and truncating it, we fork a second process. The child mmaps the shared memory, writes to it and munmaps it again. The parent waits for the child to exit, mmaps the shared mem itself, reads from it and munmaps it again. This approach, however, succeeds only in some cases. The reading process fails to obtain any content from shared mem in many cases.
Are we misssing some important step here? Or is the write operation to the mmaped shared mem an asynchronous write? Adding a sleep() in the parent seems to solve the problem, after 100 msec the reading always succeeds.
Thanks in advance.