I have a program (well, php script) which does some pretty heavy text searching - it loads a 2mb and 40mb file and searches through them to find where each word that appears in the first is present in the second.
I have a 4 core cpu (personal computer). When I start the process running, cpu usage jumps to 25%, load of 1. I start the process running again on a separate file, and cpu usage goes to 50%, load of 2. Does this reduce the efficiency of the individual processes? ie. making each one take longer to complete than if they were run separately? What about if I ran 4 processes, taking my cpu usage up to 100%? Would they run slower then?
I assume that running the two processes in parallel will complete faster than if I ran them in series, is this correct? Would it still be true if I ran more than two, say 3 or 4? Or more? Where is the bottleneck in this - I assume as long as I keep the number of processes to be equal or less than the number of cores, then the cpu can handle it, but what about memory access? Would the processes have to wait while reading memory?