I know how to synchronize between process and how to synchronize between threads. But I don't know how to synchronize between process with multiple threads.
Consider a scenario
I am creating 10 threads in a process. Each thread is printing a number.
I am running 10 processes simultaneously.
Now I need to create synchronization between process and threads such that at last, it should print 100 unique numbers in the console.Kindly note i don't expect the numbers printed in console to be in sequence , but all 100 numbers printed should be unique.
Kindly note that this idea should not only be limited to the above task. It may happen that I want to only one thread of one of the processes to execute certain code.
How to write this program in CPP for redhat.
Kindly note the version: gcc version 4.4.7.