Multicore programming: what's necessary to do it? Multicore programming: what's necessary to do it? windows windows

Multicore programming: what's necessary to do it?


The key word is "threading" - wouldn't work in a cluster, but it will be just fine in a single multicore machine (actually, on any kind of Windows, much better in general than spawning multiple processes -- Windows' processes are quite heavy-weight compared to Linux ones). Not quite that easy in C, very easy in Java -- for example, start here!


You want Threads and Actors

Good point ... you can't google for it unless you know some keywords.

C: google pthread, short for Posix Thread, although the win32 native interface is non-posix, see Creating Threads on MSDN.

Java: See class Thread

Finally, you should read up a bit on functional programming, actor concurrency, and immutable objects. It turns out that managing concurrency in plain old shared memory is quite difficult, but message passing and functional programming can allow you to use styles that are inherently much safer and avoid concurrency problems. Java does allow you to do everything the hard way, where data is mutable shared memory and you desperately try to manually interlock shared state structures. But you can also use an advanced style from within java. Perhaps start with this JavaWorld article: Actors on the JVM.