in reply to Threaded file access
Better to have a server process sitting there, accept requests for output from different threads, and act as a single point for physical write.
100 threads compete for lock against a single file could significantly decrese performance.