I'm writing a scientific application to basically crunch some numbers. It basically does the same calculation on a long list of numbers going up in a small step size. I've never written a multithreaded application but I really see this kind of thing benefiting from multiple processors. My idea was that the program would detect how many cores are present and then tell each core to perform the calculation for a different step size. So say Cores 1 through to 4 crunch the numbers 1, 2, 3, 4 and then 5, 6, 7, 8. I'm not looking for anything fancy or deeply optimised, just something that will make use of the extra cores.
How could I go about doing this, is there a way in C to detect the number of cores and is there anywhere an idiots guide to multiprocessor programming in C anywhere that someone could point me to?
Cheers,
Spanky
How could I go about doing this, is there a way in C to detect the number of cores and is there anywhere an idiots guide to multiprocessor programming in C anywhere that someone could point me to?
Cheers,
Spanky