Question on software programming from single to multi-core

polarmystery

Diamond Member
Aug 21, 2005
3,888
8
81
Hey guys,

Does any literature exist on the differences between programming practices (requirements,etc.) an engineer/programmer must adhere to when switching from a single core processor to a multi-core one? My google-fu is not what it used to be.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Generally, you code for threads not cores. There are thousands of articles on multi-threaded programming. Multi-threaded programming has been done long before desktops had multiple cores.

For a typical application, the UI has one thread, and you try to run parts of your program that would stall the UI in other threads. This could be because they are compute-intensive (like encoding WAV to MP3) or because they may need to wait on something else (request a response from a server over the net).
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
What Dave said. A properly multi-threaded app will work on single core systems as well, but should scale better on multi-core systems.
 

BrightCandle

Diamond Member
Mar 15, 2007
4,762
0
76
There a lot of texts about multicore programming, there is no one simple guide because its an enormous area of study. Each language has its own guide to doing basic multithreading within its language and that is a reasonable place to start. Almost all the problems you'll want to solve are effectively basic thread operations and more specifically parallel maps. Start with learning the concepts behind those two unless that is your language uses corountines or actors as its model of concurrency.