September 29th, 2003, 12:02 PM
One problem with file locking is it is not ANSI so you have portability problems (probably not a concern for homework, though). I would speculate that, since the rational solution is pipes, using OS API calls would probably not be in keeping with the homework. When doing multi-processing, my favored approach is to do all the common processing in the master process, then forking and doing the rest of the processing in the children without any need for synchronization. I have had the fortune of working on machines with as many as 16 processors, so when I was doing my parallel processing it is really in parallel.