Does linux execute threads of a process in parallel?
I'm beginning to wonder if Linux actually runs threads of a process in parallel without affecting the other thread? Why, because I took an app that added threads in Windows and got a 40% increase in speed and adding Linux threading there was 0% increase. Basically a ResetEvent, CreateEvent, and WaitForSingleObject function was created and conditional preprocessor defines used so the same core code executed under Window also executes under Linux. Now, how this works is there are three threads, one for the GUI update (idle for the most part but wakes up every 1 second to update GUI), the next is the main processing thread that does a fair amount of CPU intensive operations on data, the final one is one that simply reads data from the hard drive. So while thread 2 is busy, thread 3 goes and reads the next data to a buffer, and then when ready, thread 2 checks if the data is ready or it has to wait (pthread conditions), checking this I find that 95% of the time the data has already been read and ready for use (memcpy instead of needing to read from hard drive), however, the processing time is always the same, this is reading in about 18G of data. Doesn't make any since. I saw via htop that the two threads could sometimes use the same CPU as Linux moved them around, however, I later set the affinity of each thread to run on their own CPU (dual core) and see in htop that it sticks, but same result, no improvement, So I'm starting to wonder if Linux isn't running things in parallel, but instead only running one thread in a process per some time period?? Kernel is 184.108.40.206 SMP i686. Anyone have any ideas?