How do I calculate clock speed in multi-core processors?
Solution 1:
The main reason why a quad-core 3GHz processor is never as fast as a 12GHz single core is to do with how the task running on that processor works, i.e. single-threaded or multi-threaded. Amdahl's Law is important when considering the types of tasks you are running.
If you have a task that is inherently linear and has to be done precisely step-by-step such as (a grossly simple program)
10: a = a + 1
20: goto 10
Then the task depends highly on the result of the previous pass and cannot run multiple copies of itself without corrupting the value of 'a'
as each copy would be getting the value of 'a'
at different times and writing it back differently. This restricts the task to a single thread and thus the task can only ever be running on a single core at any given time, if it were to run on multiple cores then the synchronisation corruption would happen. This limits it to 1/2 of the cpu power of a dual core system, or 1/4 in a quad core system.
Now take a task such as:
10: a = a + 1
20: b = b + 1
30: c = c + 1
40: d = d + 1
50: goto 10
All of these lines are independent and could be split into 4 separate programs like the first and run at the same time, each one able to make effective use of the full power of one of the cores without any synchronisation problem, this is where Amdahl's Law comes into it.
So if you have a single threaded application doing brute force calculations the single 12GHz processor would win hands down, if you can somehow make the task split into separate parts and multi-threaded then the 4 cores could come close to, but not quite reach, the same performance, as per Amdahl's Law.
The main thing that a multi CPU system gives you is responsiveness. On a single core machine that is working hard the system can seem sluggish as most of the time could be being used by one task and the other tasks only run in short bursts in between the larger task, resulting in a system that seems sluggish or juddery. On a multi-core system the heavy task gets one core and all the other tasks play on the other cores, doing their jobs quickly and efficiently.
The argument of "6 cores x 0.2GHz = 1.2Ghz" is rubbish in every situation except where tasks are perfectly parallel and independant. There are a good number of tasks that are highly parallel, but they still require some form of synchronsation. Handbrake is a video trancoder that is very good at using all the CPUs available but it does require a core process to keep the other threads filled with data and collect the data that they are done with.
- Each core is in fact doing x calculations per second, thus the total number of calculations is x(cores).
Each core is capable of doing x calculations per second, assuming the workload is suitable parallel, on a linear program all you have is 1 core.
- Clock speed is rather a count of the number of cycles the processor goes through in the space of a second, so as long as all cores are running at the same speed, the speed of each clock cycle stays the same no matter how many cores exist. In other words, Hz = (core1Hz+core2Hz+...)/cores.
I think it is a fallacy to think that 4 x 3GHz = 12GHz, granted the maths works, but you're comparing apples to oranges and the sums just aren't right, GHz can't simply be added together for every situation. I would change it to 4 x 3GHz = 4 x 3GHz.
Solution 2:
Others made a good argument from technical point of view. I'll instead make a couple of simple analogies which will I hope will explain why 4*3GHz is not equivalent to 1*12GHz.
For example one woman can manufacture one baby in nine months. Will nine women be able to manufacture one baby in one month? No, because gestation cannot be parallelized (well, at least at this technological level).
Here's another: In a hydroelectric plant I recently visited, one of the generators was being upgraded. They had to transport the generator's stator by ship. One sixth of the stator could be transported by truck, but they needed to transport whole stator; so they had to use one ship, not six trucks.
Another case could be precise timing of events. Sometimes computer processors are used as precise timers (although the practice is no longer recommended, because of variable clock on most processors. High precision event timer should be used instead). If we assume that we have a processor with relatively stable 12GHz clock, we can use it to measure time in much higher resolution than on a processor with 3GHz clock. No matter how many 3GHz cores we have, we will not be able to reach resolution of the 12GHz core. That is like having 4 clocks with 7-segment displays where each clock just displays correct time in hours. No matter how correctly they show hours, you can't use them to measure time intervals in one second range.