31 May, 2008

Parallelizing program: chdir - fork() vs threads

When you are parallelizing your program and your parallel tasks require to change directory (chdir()) then use fork() instead of threads (OR you would need to maintain locks in case of threads and might need to sacrifice some amount of parallelization). The current working directory is maintained per process and not per thread.