Question: There are wo source files aa.c and bb.c. In the aa.c, I create a shared memory and do the fork . I do the exe()
There are wo source files aa.c and bb.c. In the aa.c, I create a shared memory and do the fork. I do the exe() in the child after fork to the bb.c file. I also increment the count in the aa.c file.
I only can read data from shared memory in bb.c file, but I need to output some data when the count are 20 and 40. It means I have to constantly check the data in shared memory.
How can I make it happen by using a semaphore? Could you please write a code to explain it?
Thank you in advance!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
