I am doing a project about a shared memory for multiple
producers and consumers. So far I have done a producer
and a consumer sharing a memory without any problem.
However, when I fork the second producer in producer(), and/or
the second consumer in consumer(), I can't get the correct
result. The 2nd producer overwrites what the 1st producer
had done, and when the 2nd consumer access the share memory, the
1st consumer automatically receives what the 2nd consumer had
taken.
Can someone kindly show me some suggestions?
Thank you very much in advance if there are some.