Re: dual core and c



kerravon wrote:
Assuming I am running a C program that is doing some cpu-intensive
work
such as zip -9, I can understand:

If I have 8 CPUs, then it will make no difference at all to the zip
program,
it will only run on one of the CPUs, although this does allow me to
run 8
separate zips simultaneously, which would be cool on a large site.

But what I don't understand is the concept of a "core", as in "dual
core".

<off-topic>

What's usually meant is that a "core" is most of a CPU,
so a "dual-core" processor has two CPUs on one chip, an
eight-core processor has eight, and so on. It's not quite
as hard-and-fast as that, because the chip usually has some
components that are shared by all the cores but that would
be per-CPU resources in a traditional design: Caches, memory
controllers, I/O ports, and so on. But to some fuzzy level
of approximation, a core is a CPU.

</off-topic>

What implications does that have for a C program like zip? Does it
have the ability to look at the instructions ahead of time and
pipeline
them or something? Pipelining is something that has been around for
a long time. Did someone just get the bright idea to call it dual
core
instead or what?

<off-topic>

This is a question for a computer architecture forum,
not a question about a programming language.

</off-topic>

Assume the zip in question is written in C89, no fancy parallelism -
at
least not inherent in the language itself.

<ON-topic>

The C language is defined in terms of an abstract machine
whose operations are almost entirely sequential. ("Almost"
because there are a few grudging nods toward asynchronous
activities -- signals, some uses of `volatile' -- and because
there's some leeway between "sequence points.") Thus, the C
language itself is almost entirely sequential; there's no
built-in way to express parallelism.

However, implementations of C are not required to model
the abstract machine in every detail. A principle called
the "as-if rule" allows an actual C implementation to play
all manner of optimization games, provided the ultimate outcome
is "as if" the abstract machine had performed the computation.
So if a compiler can detect opportunities for parallelism in a
C program, it's free to exploit those opportunities if it can.
But the C language itself gives you no way to control this --
indeed, by the way "as if" works, it gives you no way to
detect that something has been parallelized.

</ON-topic>

--
Eric.Sosman@xxxxxxx
.



Relevant Pages

  • Re: Deep Fritz for Core2 Duo?
    ... You can switch the free Crafty engine into running on multiple cores and it will give a fair benchmark of how system would behave with other chess engines. ... CPUs 6403 kN/s ... Only in a badly designed parallel search strategy. ... Two cores on a slow multicore against one core on a nominally twice as fast machine with the same engine would be an interesting test. ...
    (rec.games.chess.computer)
  • Re: Beyond multicore
    ... Using 200-odd pins to support a DDR-III ... device between this DRAM and the on-die Memory Controller. ... linear scaling) current 3 GHz CPUs need about 10 GBytes/sec of DRAM BW/ ... In order that each CPU core has about the same L-big ...
    (comp.arch)
  • Re: Beyond multicore
    ... Using 200-odd pins to support a DDR-III ... device between this DRAM and the on-die Memory Controller. ... linear scaling) current 3 GHz CPUs need about 10 GBytes/sec of DRAM BW/ ... In order that each CPU core has about the same L-big ...
    (comp.arch)
  • Re: Advice on a multithreaded netisr patch?
    ... using the core? ... CPUs 4-7 for only network processing". ... Be careful not to migrate threads that hold locks the ... Be careful not to migrate the main boot thread. ...
    (freebsd-net)
  • Re: [PATCH v7 0/8] Tunable sched_mc_power_savings=n
    ... read/write-per-sec result for comparison. ... quad core package that consist of two dual core CPUs. ... domain 0: span 0,2-4 level MC ... have two groups each with two cpus representing two dual core CPUs. ...
    (Linux-Kernel)