Shan wrote:I hate to post a "Well it works for me" but quite simply...it does. Admittedly it didn't to begin with when I used the (apparently out of date) formula for figuring the -j value: #CPUS+1. I can't recall where I read it (I think the gentoo-wiki) but it seems as though the general concensus is now # CPU's (or cores as the case may be) * 2 +1. EG for my AMD64 X2 4800 my make.conf has -j5 and it seems as though both cores are thoroughly utilized during compilation.
Yes I used -J5 I believe.
My guess is that this "rule" only applies to dual core systems, and not true multi-cpu. That is, multiple-cores on one die opposed to multiple separate chips. Furthering speculation I would imagine this is due to a dual-core system having a much lower latency compared to multi-chip setups due to intercommunication being handled right on the die. Since there's less time spent "working" on communication, there's more free time for actual compilation, which means things get done quicker and the end result is still waiting for things to do unless you have enough queued up to go.
Mult-core is the same (99+%) the same as multi-proc, most implentations are sharing the external bus (Intel), or connected to the crossbar switch in AMD. Core2Duo since it shares the L2, it can snoop and talk with the 2nd core w/o bus cycles basically on the pins. But before the dual cores were connected to the same IO pins as if they were seperate.
Now while none of this is what you're proposing, I personally think having more "makes" running for one program is better than having multiple program compilations going. Unlike CPU and RAM speeds, hard drive performance hasn't increased much over the last decade or so. To be sure capacity has skyrocketed, and new technologies exist that are indeed faster, but comparatively speaking your bottleneck is still disk I/O. With parallel compilations of a single package, you have the initial package decompression, configuring, and so on all the way through installation, but the main section (compilation) is largely done in memory (on systems with sufficient ram to allow). Unfortunately there is still sufficient enough disk I/O going on that if you were to toss in a second (third or even fourth) package being compiled any performance gains would likely be negated by the degraded disk I/O. I think, even at best, you would only be able to attain the same performance as a system with a properly set -j flag. Remember, the recomendations in make.conf aren't laws, merely guidelines for what will be sufficient for most people.
On say, my system 3.15Ghz Core2Duo 2GB box. 4MB cache, The system was barely paging with the above mentioned MakeOpt. But you remined me of something I was going to discus and forgot.
A backage build is more than compiling. And I will say ST here loosely as at a very fine grain, interrupt handling could be on a 2nd proc, but that doesn't chage the overall process. And yes you can have mutiple threads badly written, or an algorythm just didn't need to be multithreaded to create speed gains, but I digress.
1) Source download. (Single )
2) Source expansion (Single threaded) (Not to bad speed wise)
-- #3 can take a good portion of the time in a medium sized package.
3) Automake, Auto config, ./config... (again single threaded)
4) Compilization, (single threaded process)
5) Link step
6) Pkg compression.
7) Install.

Portage DB work.
Now with all these linear processes, that chain together to form a 'job'/'batch', They may not 'sit' on a proc, but once scheduled for the timeslice its on a proc, idling the other. DistCC speeds up step #4, yes on BIG compiles it can cut down on compiles, but the rest of the batch is still linear.
Which package was it that drives me nuts. GTK+? Making some files, the program xslt<someting> 100% cpu, single threaded and nothing else getting done for a great number of minutes, where as if the ebuilds where chuggling along on the other processor, things could be moving forward and please don't mention about some use flag, that's not the main point.
Package installation is a linear, date in, process, data out, into another process, munge that data, output result. By emerging X non-depedant builds together we can bring back some multi-tasking to this process.
Two final things however: An offshoot of your idea would be a version of portage that continues a merge even when a package fails. For example, it peeves me to no end when I setup my machine to update overnight, and it bops out two or three packages in wasting a good nights compile. It would be incredibly lovely if portage could detect A) the failure B) continue on with the emerge command removing any packages that depended on the failed compile. Atleast that way SOME of the work would get done without a total waste.
Yes I have been bitten by this too. Always seems to be 10 mins after you walked away from the monitor, no matter how long you sat there watching it.