So I am trying to figure out the logic for this homework assignment. Can someone help? From what I understand I have to create 2 processes which reads the N from the given file and increment that N number by 1. The part I don't understand is how I assign odd and even integers to these 2 processes when both of them are doing the exact same thing.
Write a simple sequence-number system through which two processes, P1 and P2, can each obtain 50 unique integers, such that one receives all the odd and the other all the even numbers. Use the fork() call to create P1 and P2. Given a file, F, containing a single number, each process must perform the following steps:
a. Open F.
b. Read the sequence number N from the file.
c. Close F.
d. Output N and the process' PID (either on screen or test file).
e. Increment N by 1
f. Open F.
g. Write N to F.
h. Flush F.
i. Close F