Programming Multiple Cores in C

Programming Multiple Cores in C

Post by tinkerC on Sun Apr 05, 2009 10:31 am
([msg=21182]see Programming Multiple Cores in C[/msg])

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
Last edited by tinkerC on Sun Apr 05, 2009 4:49 pm, edited 1 time in total.
tinkerC
New User
New User
 
Posts: 11
Joined: Wed Feb 11, 2009 3:53 pm
Blog: View Blog (0)


Re: Programming Multiple Cores in C

Post by BhaaL on Sun Apr 05, 2009 11:02 am
([msg=21186]see Re: Programming Multiple Cores in C[/msg])

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.
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)


Re: Programming Multiple Cores in C

Post by tinkerC on Sun Apr 05, 2009 4:51 pm
([msg=21222]see Re: Programming Multiple Cores in C[/msg])

What if your OS is pre-multi core ( I know about the threading term ).
tinkerC
New User
New User
 
Posts: 11
Joined: Wed Feb 11, 2009 3:53 pm
Blog: View Blog (0)


Re: Programming Multiple Cores in C

Post by BhaaL on Mon Apr 06, 2009 11:22 am
([msg=21301]see Re: Programming Multiple Cores in C[/msg])

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).
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)


Re: Programming Multiple Cores in C

Post by tinkerC on Mon Apr 06, 2009 8:00 pm
([msg=21329]see Re: Programming Multiple Cores in C[/msg])

Mac OS X 10.3 ( Panther ). Do you know how pthreads work?
tinkerC
New User
New User
 
Posts: 11
Joined: Wed Feb 11, 2009 3:53 pm
Blog: View Blog (0)


Re: Programming Multiple Cores in C

Post by BhaaL on Tue Apr 07, 2009 2:00 pm
([msg=21366]see Re: Programming Multiple Cores in C[/msg])

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.
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)



Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests

cron