I've never done any parallel programming, and I know the advantages of parallel programming, however, I'd like to learn more about the subject, and how I can make a basic program that actually uses the concept in practice. Can anyone point me in the right direction as to where I can stat to learn how to implement parallel programming? I know of examples that actually use parallel programming, however, I don't know how you'd go about implementing it.
You mean like multi threading?
If we're talking about implementing it I think you'd need to name a language unless I didn't understand the question.
Pretty much, yeah.
Could you just make a thread listing all the shit in code you're bad at this is the third thread in the last 2 months.
I'm just trying to learn? I mean there are somethings that I haven't even tried yet, so I have no idea if I'm good or bad at certain things, I've tried a few different languages. I've also not learned a lot of things, like graphics programming as an example.
I'm still a student, hence the many questions about coding, I want to be good at this. I'm sorry if I've annoyed you?
Just kind of aggravating that the 1 code thing is like the same question from you with a different title. I get you're learning, just look at the context that you're writing about and think "Can I add this to another one of my posts and have it expand that rather than adding more flak".
I guess that's a better idea, the only reason I don't do that is because in previous attempts, I've had no responses from older threads, hence why I make so many. I do feel like a d!@* for making so many, I just don't get many replies, I totally get where you're coming from.
Yeah when that happens I just throw it to the lounge and see what happens.
Threading is about as frustrating as it gets.
Dependant on your language of choice there is syntax to be vary off, and then there is the whole how does threads work thang during a program.
Basically a thread is a piece of your code which branches off from your original a to z code, where it operates independantly, and it is your job to make sure this thread doesn't cause a deadlock, and is synchronized with your main thread.
Some languages like java has properties like "synchronized" for your methods and classes etc. but all in all it is up to you to keep your tongue straight and make sure your threads doesn't wreak havoc...
If you wanna learn about threading id advice you to read about semaphores, and threads.
Creating a thread in a given language is sortta easy, understanding how it work is something i couldn't write here due to insane amount of theory.
I guess I could try that, I haven't tried it before because it seems like people in the lounge are just having amusing and general conversations, at least whenever I have looked.
Dont worry threads are a biatch, they suck, and id guess the main cause of alcohol abuse. Im far from a thread jedi, i still prefer the good'ol script to handle my tasks.
But threads are why we have multi cored CPUs/GPUs, and a very effiecient way of handling software, and is a discipline you need to learn.
If that's the case, I may as well start right away? - I'll start tomorrow as it's pretty late right now, and I should be considering in sleeping sometime soon.
You do kinda post a lot of coding threads... You have to remember that the number of coders here is very small. Furtheromre, the number of coders with time to explain things (that you could just google and read from the plethora of resources on the interwebs) is even smaller....
TL;DR: 90% of peeps here are self-taught IT, not coders with spare time.
I appreciate that totally, I should really try to keep that in mind, and I am sorry, I just tend to ask you guys when I'm clueless or stuck, I guess I should just go to YouTube or Google stuff more.
Again, I am sorry.
EDIT: I guess I could even turn to StackOverflow for a lot of my questions.
Well you know how to handle 1 thread, why not expand to 2 threads.
If you're gonna be a programmer, you need to know how to control a thread, and make sure it doesn't rape your other threads(e.g. read up on semaphores).
Everytime you're programming GUI, event handlers fx. you're working with threads.
Threads are everywhere.
Even when you're compressing a file with winrar it uses threads to spread the load onto different cores, so yea deffinetly learn threads, everything you do today is threaded. Windows is threaded, properly runs like 500-1k threads without you knowing it.
I won't hook you up with code examples as all coding it is a learn by doing, so ill let you train your google foo for this one.
But my best advice is learn what a thread is, how to control it by reading tedious theory, then google foo your way to a few code examples.
I totally agree with you there, I mean just looking at something and finding out it works, that's not learning, learning is taking something, understanding it and then expanding it.
@Argon
other than knowing how to do threads in the language, you will have to be able to determine if your problem can be solved easier/faster with more threads.
examples: if you wanted to copy a file in c you'll usually hit filesystem/drive limitations before the single thread becomes too slow.
but if you were manipulating the data to do something. then you could load it and then manipulate it with multiple threads if you needed to do that much manipulation. if you just need to do a bunch of separate calculations which werent dependent on previous ones. if you just need to do them and record the output, then you could load all of them and do 1/2 on each of 2 threads, or 1/4 on 4 threads etc. and put the data back together for presentation after its finished.
but if you needed to do it in a specific order in 'real time'(like as fast as possible in the exact order) then you need more strenuous thread synchronization. as far as loading the data, doing the calculation(s) presenting results. which introduces alot of overhead. but may be required for certain use cases where you need to see the data output in a specific order or timeline. where the calculations/operations are dependent on previous ones.
you may have to entirely reconstruct how you approach problems to get speed from using multiple threads
Thank you very much for your input, I'll be sure to start looking more into it sometime soon! :)
I like the idea of finding new ways to approachieve and tackle problems, I know it's not greatly different, but comparing OOP language's to functional language's, it's somewhat different.
just mean if you considered a batch of frames, if you're transcoding a file it doesnt matter the latency at all of the frames just the raw number of frames per amount of time, where in a game or during playback of a video file whatever, the latency matters alot, where if you had 120fps but it delivered 4 frames at the exact same time it could look to the user like 30fps,
trying to get the highest throughput at a desired latency is a totally different problem then just trying to get the highest throughput with a given amount of processing power.
but in general is alot of identifying what can and cant be done in parallel versus serial using a specific method, if you started to split those frames into quadrants or whatever you could decrease the latency by decreasing the time each thread would be working on the quarter or frame or whatever but increase overhead reducing overall framerate/latency by dispatching 16 mini frames/synchronizing 4 times. then if you compared the time to dispatch and do 4 frames and just output them whenever they finished.
least from what i can gather anyways lol.