Subj : Re: help with basic multithreading in C on solaris To : comp.programming.threads From : David Schwartz Date : Sat Feb 26 2005 10:34 am "Winbatch" wrote in message news:tn0Ud.14918$qn2.3131614@twister.nyc.rr.com... > Hi, I'm trying to learn multithreading and it doesn't seem to be working > for > me. I have a feeling it has to do with the fact that I'm writing to files > rather than to printf, but maybe not. Basically, I wanted to see if it > would be faster to write to 4 files at the same time (parallel) rather > than > 4 in a row (serially). however, when my multithreaded code executes, it > seems to do them in order anyway (I expected to see Starting/Ending all > mixed rather than in order). Does anyone know what I'm doing wrong? > (Note, > I also tried to do it with 4 different functions (ie, go, go1, go2, etc.., > but that didn't seem to fix it). Try it with reads rather than writes. When you write to a file, the operating system just stores the data in memory to write to the disk when it can, so there's no benefit to parallelizing. Because none of the threads ever block for I/O, the operating system has no reason to switch from one to the other, so each thread is allowed to run for as long as possible. DS .