How do I calculate clock speed in multi-core processors?

77,763

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.

  1. 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.

  1. 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.

Solution 3

I'm not an expert on the subject, but I do have a degree in Computer Engineering. In theory (this is a highly conceptual answer), a quad-core 3GHz each processor can be the equivalent of one 12GHz processor if, for example, there were four sets of calculations needed for a single end result. That is what's called parallel processing.

To simplify the logic, let's say we're talking about a dual core processor. If a set of calculations were, say:

a=b+1;

c=d+1;

then, those two calculations could be executed on separate cores, and an xGHz processor would be equivalent to a single-core 2*xGHz processor. This is because the two calculations, although done at x speed, would be processed at the same time. Whereas the single-cored processor could do them at 2*x speed but one after the other. If the two CPUs executed this code at the same time, they would finish at the same time. However, if the code were:

a=b+1;

c=a+1;

then, the dual-core processor would take twice as long as the single-core processor because in the second instruction, the value of a is dependent on the first instruction and thus cannot be executed in parallel. This is how some software can take advantage of multi-threaded processors.

So, in theory, a 12GHz single-core processor can always run as fast (or faster) than a 3GHz quad-core processor, but not vice-versa.

Solution 4

It appears that we can't say that 4 cores @ 3 GHz can be said as 12 GHz.

Various Constraints like shared memory, cache contention and other resources too are common to all the cores so running a piece of code parallel on these cores will not be as efficient as running it on 12 Ghz processors (although it is difficult to build such a processor ).

Also i read somewhere that if we double the transistors embedded on the chip (CMP) , the speed up we are going to get is only 40% . This provides a significant hint to this topic also.

Solution 5

This is a complicated question to answer, but the short answer is: No

In real world applications four 3Ghz processors will not be as fast as a single 12Ghz processor due to inefficiencies. They may be very close, but they will NOT equal a single processor in terms of processing power.

The reason for this lies in the small inefficiencies when dealing with programs that can run on more than one processor. Assuming that the program in question can run in parallel, we will still run into problems with different cores competing against each other for other resources such as RAM or even cache and thread synchronization problems. Also, there are always parts of programs that can not be parallelized and need to run on a single core by itself.

Take a look at this article: http://en.wikipedia.org/wiki/Amdahl%27s_law

Share:
77,763

Related videos on Youtube

NReilingh
Author by

NReilingh

I like music and computers. 

Updated on September 17, 2022

Comments

  • NReilingh
    NReilingh over 1 year

    Is it correct to say, for example, that a processor with four cores each running at 3GHz is in fact a processor running at 12GHz?

    I once got into a "Mac vs. PC" argument (which by the way is NOT the focus of this topic... that was back in middle school) with an acquaintance who insisted that Macs were only being advertised as 1Ghz machines because they were dual-processor G4s each running at 500MHz.

    At the time I knew this to be hogwash for reasons I think are apparent to most people, but I just saw a comment on this website to the effect of "6 cores x 0.2GHz = 1.2Ghz" and that got me thinking again about whether there's a real answer to this.

    So, this is a more-or-less philosophical/deep technical question about the semantics of clock speed calculation. I see two possibilities:

    1. Each core is in fact doing x calculations per second, thus the total number of calculations is x(cores).
    2. 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.
    • Iszi
      Iszi over 11 years
      Many of the answers here do a good job of explaining why e.g. a quad-core 2 GHz processor is not necessarily equal to a single-core 8 GHz processor. However, I'm having a difficult time divining how multi-core processor speeds should be regarded when deciding a system's suitability for an application that lists a specific speed and number of cores in its requirements? (e.g.: Borderlands 2 requires a 2.4 GHz dual-core processor. Should we expect a lower-speed quad-core, or higher-speed single-core to do just as well?) Is that (or could it be) answered here, or should it be a separate question?
    • NReilingh
      NReilingh over 11 years
      @Iszi That should be another question, but it's likely that Borderlands is optimized for more than one thread if they're including "dual core" in their requirements. In that case, a single-core processor would not be recommended, but it's unclear if it can take advantage of > 2 cores.
    • tvdo
      tvdo over 11 years
      It is important to remember that the clock speed and number of cores do not solely determine the 'speed' of the processor. For example, the cache sizes and speed will affect the time the processor spends waiting for instructions and data. Additionally, the instructions per cycle (in a way, 'efficiency', though distinct from and related to power efficiency) will also affect speed of calculations. Different processors will take different times to execute the same instruction.
    • Breakthrough
      Breakthrough almost 11 years
  • user3763403
    user3763403 almost 14 years
    You are right and wrong. Four 3ghz processors will most likely be FASTER than a single 12ghz processor in "real world" applications. These days more and more programs are using multi-threading, the link you gave is referring to a theoretical single thread application. A single processor at 12ghz only has one thread, so the multi-threading benefits a "real world" program has to offer would be lost. The industry isn't going toward more slower cores instead of fewer faster cores just because, the benefits of multi-core technology far outweigh the benefits of fast single core technology.
  • Sasha Chedygov
    Sasha Chedygov almost 14 years
    @typoknig: That's not quite true. A 6GHz single-core processor would run a multi-threaded application at about the same speed as a 3GHz dual-core processor, assuming the app is taking full advantage of every thread (which it most likely is not doing if it is a "real world application", but that's a separate argument). We don't see 12GHz processors because it's too difficult with current technology, not because it's slower.
  • UNK
    UNK almost 14 years
    Note that those calculations will only be faster if it's mutlithreaded, and even then there's a slight overhead. But yes, while it's possible to make a single core processor that can do as many calculations, it simply isn't plausible due to heat and stuff.
  • Faken
    Faken almost 14 years
    @typoknig: I've programmed some mutithreaded programs and believe me, if i had a single 12Ghz processor, id use that instead. Single threaded programming is 10x easier and much much more efficient than muti threaded programming. The real reason why the industry is moving twords muticore processors is not because they are faster, its because we can't make individual CPUs run any faster! This was outlined with Intel's netburst technology back in the p4 days. They estimated 10Ghz processors, at least, that is until quantum physics slapped them in the face and said "no noob!"
  • user3763403
    user3763403 almost 14 years
    @musicfreak, what about running 6 apps at once, or a dozen? People multi-task, that is real world, and a single core processor does not support that. I agree that with a single application the speeds would be close, to close to argue about in fact, but when it comes to multi-threads that is where multi-cores shine. Technology is being developed for faster processors with materials like graphine. Lots of embedded processors (like flight processors) already run over 10ghz with current technology (like the f-22). Multi-core is cheaper and it seems to fit our multi-tasking life style better.
  • Faken
    Faken almost 14 years
    @typokning: The F22 uses an array of powerPC processors to achieve 10 billion instructions per second, very different from being 10Ghz! Its like saying your Radion HD5970 operates at 4600Ghz. It's capable for 4.6 TFLOPS but only because it's highly parallel.
  • Sasha Chedygov
    Sasha Chedygov almost 14 years
    @typoknig: Why would a single-core processor "not support that"? Have you never run a dozen apps on a single-core CPU? I don't think you know how parallelism works. Single-core CPUs emulate parallelism by sort of "taking turns" with each application. Theoretically, this method should be exactly as fast as true parallelism with a proportionally slower CPU. (In reality, the multi-core processor would be a little slower because of cross-processor communication.) How exactly would a dual-core 3GHz CPU perform better than a single-core 6GHz?
  • Faken
    Faken almost 14 years
    @musicfreak: Umm, well, its a little more complicated than that. There are inherent inefficiencies when dealing with muti threads on a single core system. We end up with inefficacies in context switching, that is when a single core switches in between different programs (penalty taken for shifting between threads of the same program are pretty much nill though). Either way though, a single faster processor will still win in the end unless we are dealing with a lot of slow I/O operations. Thats where a muti core system would be beneficial.
  • user3763403
    user3763403 almost 14 years
    @Faken read the section on CIP at this link: globalsecurity.org/military/systems/aircraft/f-22-avionics.h‌​tm Clearly states in the last paragraph that each CIP (two in each f-22) operate at 10.5 billion instructions per second. Saying that this speed is obtained only because the system is highly parallel is not fair. That is like saying a standard PC processor obtains its speed because its transistors work in parallel. Regardless, as @musicfreak and I have both said, the speed difference between single and multi core is minimal, we just disagree on which on is a hair faster.
  • Sasha Chedygov
    Sasha Chedygov almost 14 years
    @Faken: I know I over-simplified it, but for the purposes of this discussion it's accurate enough.
  • Faken
    Faken almost 14 years
    @typoknig: You clearly don't understand the difference between CPU frequency and IPS (instructions per second), they are not one in the same. Please read: en.wikipedia.org/wiki/Instructions_per_second
  • user3763403
    user3763403 almost 14 years
    I thought IPS and GHZ were a direct correlation of each other, after reading that link I can see I was mistaken about the f22. The fastest stock chip I could find is the IBM Power6 P595 which was released at 5.0ghz. Even at that speed, I do not think you guys are giving multi-core chips the credit they are due. Still our discussion (on both sides) is based on specific operating environments (a single core chip running a single thread, a multi-core chip running multiple threads, ect). With that said I think each may do better in certain situations, and even then the difference would be minimal.
  • TechWriter
    TechWriter almost 13 years
    Nice post.. Could not vote more than 1+ :-(
  • David Schwartz
    David Schwartz almost 11 years
    This answer is misleading for two reasons. First, modern cores do more than one thing at a time. Second, the answer assumes that the core speed is the same as the rate at which work is done. A 12GHz single-core processor won't run as fast as a 3GHz quad-core processor if the single-core processor needs significantly more clock cycles to accomplish the same work. (Which it would since a 12GHz processor would need much longer pipelines.)
  • David Schwartz
    David Schwartz almost 11 years
    "In real world applications four 3Ghz processors will not be as fast as a single 12Ghz processor due to inefficiencies." Quite the reverse, a 12GHz processor would be terribly inefficient, requiring absurdly long pipelines that would result in atrocious performance. That's why Intel significantly dropped the clock speeds when they abandoned the NetBurst architecture and adopted the Core architecture -- they realized such high clock speeds were actually hurting performance. Nothing comes for free -- high clock speeds have high engineering costs that can hurt you.
  • David Schwartz
    David Schwartz almost 11 years
    Clock speeds are not listed on a "per-core basis". Speeds are never "per" anything. If a car is going 50 miles per hour, the speed is 50 miles per hour. If two cars are going 50 miles per hour, the speed is still 50 miles per hour. The idea of a "speed per car" is meaningless and incoherent.
  • aff
    aff over 9 years
    Useful answer for the less technical-minded. Also, I like analogies :)
  • Justin Meiners
    Justin Meiners over 5 years
    But amdahl's law is a programming concern, caused by locking, not a hardware concern. If you don't need to synchronize, each core could execute instructions as fast as it can go. One could design a parallel program (a simple one) that would be perfectly split between cores. Wouldn't hardware manufacturers advertise this raw value?
  • Justin Meiners
    Justin Meiners over 5 years
    To clarify, I understand why this answers the question of why 4 cores at 3 ghz are not as fast, in practice as a 12ghz, but the not the part of how clock speed is calculated for multicores.
  • Mokubai
    Mokubai over 5 years
    @JustinMeiners clock speed per core is simply the clock speed the core runs at. There is no magical calculation that equates a single core to multicore. Multiple cores just means that you can run more separate tasks simultaneously. Amdahls law applies because of software, the syncronisation and locking needed will prevent a task from being "perfect" in hardware just as much as software. Shared caches and memory causes contention and locks to occur.
  • Justin Meiners
    Justin Meiners over 5 years
    @Mokubai Just to clarify, when a manufacturer lists the clock speed, each individual core runs at the speed, correct?
  • Mokubai
    Mokubai over 5 years
    @JustinMeiners yes. Ignoring features such as turbo boost and power saving the speed stated by the manufacturer is the nominal per-core clock speed.
  • Justin Meiners
    Justin Meiners over 5 years
    @Mokubai yeah sorry, that was poor wording. I understand the hardware may sometimes need to synchronize as well and is bound by the same law, I was just pointing out that amdahl's law is not a limit on how many instructions can be processed by the cores. The degree to which amdahl's law affects you depends on the kind of task you are trying to execute and how much the other cores have to wait for each other, so it would be confusing for hardware manufacturer to try and account for that beyond their own synchronization.