in reply to Process file simultaneously after forking
They way I handled this for doing work on a 8 way beowolf cluster was to take the data set and split it into 8 chunks. This seemed easier than trying to deal 1 to each machine in order.
In your case either split your file into 2 files before forking then each process deals with a half or (if possible) have the second seek to halfway through the file and start there, and make sure the first ends just before the second started.
This should be much better than trying to synchronize each thread, if you do it that way then you don't gain nearly the performance of having 2 unsynchronized threads. (A lot of time would be spent waiting for the other thread to work).
As I'm thinking of it, In each thread have the parent do odd lines and then have the child do even lines. As long as you are not modifying the original file you should be fine. (same concept as above).
If you are going to modify the file then have each thread write it's own temproary file, then after the major processing is done (child exits), have the parent merge the output, based on how you divided the data set.
If you could describe the nature of your problem it would make most of my guessing, and ideas go away and the "right" way to do it would become clear.
Hope this helped!