question-nplease help me(contains semaphore, thread, process)

I need to write c programming able to generate 3 processes able to work in a chain, for example, each process waits for a predecessor to start again, in a circular way(process 3 is the predecessor of process 1, after a first elaboration).

a: process 1 generates a random number N (between 10 and 100)and then N random numbers (between5 and 10) to be sent to process 2.

b: process 2 generates, for each number received, a sequence of characters of the same size (characters must be random from a to z and in lower case) and send each word to process number 3.

c: process 3, once received all set of words, looks for two or more words of the same size.

if they exist, it runs one thread for each pair of words to calculate their distance of hamming. for example: if 3 words w1, w2 and w3 are of the same size, then we need to run 3 threads: (w1, w2), (w1, w3), (w2, w3). the distance of hamming for words of the same size is the number of positions at which the corresponding symbols are different, once all threads end their evaluation.

if at least one pair of words have a distance of hamming equal or bellow one, the process sends a terminating message to all processes, otherwise it asks process one to generate a new sequence and wait.

if they don't exist in the set, it asks process 1 to generate a new sequence.

the whole process terminates in any case after a R number of maximum repetitions, which must be asked to the user by command line.
if process 3 find words with a distance of hamming equal to or below 1, try to display them properly in the final implementation.

every one can, please help me about this question. thank you
Sounds like you could just use pipes or sockets to do the IPC.

Also, why do you need to create a thread for each pair of words? What's the point of that?
Topic archived. No new replies allowed.