Starting out with real coding: parallelize?

well, coding is relatively new territory for me, I've been working with Racket and Javascript this semester, so I have the basic logic down, for the most part, but next semester, i'm gonna be starting out in Java.

being an AMD user, and also looking at the modern trend towards parallelization, I personally feel that programs should be coded to use multiple cpu threads whenever possible and reasonable. I mean real multithreading, 4+ cores, none of this "hurr durr it uses another core for garbage collection" parallelization.

so, I am wondering if it would be a good idea to learn to write multithreaded programs starting off, so as to get in the habit of doing so for the future?

and if so, is it better to start off with 2-core threading, and work my way up, or just dive into 4+ core?

or am I just getting ahead of myself with this?


inb4 "not everything can parallelize, dumbass": I do understand that there are quite a few cases where it is not possible, or simply pointless to parallelize.

Usually it is easiest to write without worrying about the threading of a program when you first start out with a language. As far as is it a good idea? Yeah, its good. Is it really something that new people to specific languages would find easy in most cases? Nope. Threading can range from easy as breathing to as hard as destroying the earth by digging with your thumb.

If the program is not of large magnitude or very resource heavy, you can usually get away with just writing a program without worrying about threads much. If you're writing say, a game or game engine, its optimal to write parallel, but isn't really needed unless you're writing a really complex game with large usage. 

Either way, parallelism depends usually on the program. When writing its best to just learn the language. Its easiest to start at the top and dig down than crawl up from the bottom when learning. 

that's what I thought people would say... and you definatly know better than I with this...

learn the basics before trying anything fancy. sounds liek a good idea, lol.

Another thing you might want to check out is OpenMP. It's written for C++ but I think someone is working on a Java implementation as well. It's really handy as in some cases you just need one line of code to make your code run in parallel. OpenMP and MPI is what we were using to write large parallel code to run on a supercomputer this semester, but you don't need MPI if you just want multithreading.

As has been pointed out though you can always just use Java threads if you're coding your stuff in Java! Just throwing some options at you.