Re: dual core and c
- From: user923005 <dcorbit@xxxxxxxxx>
- Date: Fri, 29 Feb 2008 14:14:58 -0800 (PST)
On Feb 29, 7:13 am, kerravon <kerra...@xxxxx> 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".
What implications does that have for a C program like zip?
In order for a C program to take advantage of multiple threads of
execution, it will require a non-portable call to create threads or
processes or to use an interface like MPI.
See, for instance:
http://www.cs.cf.ac.uk/Dave/C/node29.html
http://www.mhpcc.edu/training/workshop/mpi/MAIN.html
Does it
have the ability to look at the instructions ahead of time and
pipeline
them or something?
Usually, the programmer has to take some kind of action, but some
compilers can spit out parallel tasks to some degree.
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?
Pipelining does not rely upon more than one CPU core. You can have
multiple pipes executing simultaneously on a machine with a single CPU
with only one processor on the CPU.
Assume the zip in question is written in C89, no fancy parallelism -
at
least not inherent in the language itself.
Yes. The Cilk langugage is a modification of C that tries to make
threading more transparent:
http://supertech.csail.mit.edu/cilk/
If you want to actually implement something that works in parallel,
probably pthreads is the closest thing to a ubiquitous interface in
C. It works on Windows and many Unix variants.
http://en.wikipedia.org/wiki/POSIX_Threads
If you are programming in a Unix or POSIX environment, you might try
news:comp.programming.threads:
http://groups.google.com/group/comp.programming.threads/topics?lnk=sg
.
- References:
- dual core and c
- From: kerravon
- dual core and c
- Prev by Date: Re: Is there stack associated when a executing an inline function?
- Next by Date: Re: Is there stack associated when a executing an inline function?
- Previous by thread: Re: dual core and c
- Next by thread: array index and pointer, which is faster?
- Index(es):
Relevant Pages
|