Page 1 of 1

Programming Multiple Cores in C

PostPosted: Sun Apr 05, 2009 10:31 am
by tinkerC
I want to know how I can get the most from my code, and as speeds per core stay the same, I am looking toward using multiple cores. Most GOOGLE searches come up with news articles talking about multiple cores, and multi-threading C. None of the two useful pages explained the functions at all. I speak C fluently. Please help me with this,

tinkerC

Re: Programming Multiple Cores in C

PostPosted: Sun Apr 05, 2009 11:02 am
by BhaaL
Assignment to cores is usually done by the OS, so you simply run stuff in parallel rather than doing it in a sequential manner.
Keyword: Threads.

Re: Programming Multiple Cores in C

PostPosted: Sun Apr 05, 2009 4:51 pm
by tinkerC
What if your OS is pre-multi core ( I know about the threading term ).

Re: Programming Multiple Cores in C

PostPosted: Mon Apr 06, 2009 11:22 am
by BhaaL
Which one would that be? Windows 98?
Most OS recognize Multiple cores as multiple CPUs for that matter, and *should* be able to do the right thing. I can't promise it will happen, but I dare to say that any modern OS (Windows, yes, starting with XP of some sort; and pretty much every *nix derivate) will do the right thing.
Easy check, run [number of cores or cpus] threads doing work; could be a rather useless infinite loop aswell - check your task manager or whatever lists your cpu usage, and see if it reaches a total of 100% (windows defines the total load as sum of all cpu/core loads divided by the amount of cpus/cores).

Re: Programming Multiple Cores in C

PostPosted: Mon Apr 06, 2009 8:00 pm
by tinkerC
Mac OS X 10.3 ( Panther ). Do you know how pthreads work?

Re: Programming Multiple Cores in C

PostPosted: Tue Apr 07, 2009 2:00 pm
by BhaaL
I thought you knew about your code?
We used pthread way back with the auRose server, but i barely had anything to do with those.

I'm sure the docs will help you on that. But in general, OSX should be able to handle that correctly.