- Home /
Question is off-topic or not relevant
Threading. What is it?
I'm pretty new to game development, and don't know too much about computers specifically, but one optimization technique I've been hearing is threading. I've been hearing things like, "Run it on a second thread, which will make it run much faster," and such and I've been given that advice, but have never known what to do with it. What I do know is that its used to optimize and decrease CPU overhead. I've sort of pieced together this image that it runs the code separately from the rest of the code because it's only using certain API to perform its tasks. But I'm not sure if thats right, or if its the complete picture. So I've been searching online for a little while and didn't exactly find the answers I was looking for.
So my question is: what is threading, what is it useful for, and how should I implement it in Unity? Thanks a ton!
Answer by Julien-Lynge · Jan 26, 2013 at 07:48 AM
This isn't a Unity question, and so probably isn't appropriate for this answer site. This is a programming question, and one that has been answered many times in sites like Stack Overflow, not to mention in introductory books on programming or computer science.
Before we answer any questions, I suggest a Google search. Try starting with "programming what is threading" and look at the Wikipedia article, Apple article, Microsoft article, ...
BTW: this wasn't meant to be purely snark. Your second question (how should I implement it in Unity) is Unity-related, but is meaningless until you understand threading. (And, by the way, it's a question I guarantee you can find a lot of information on by searching here and in the forums, hint hint)
Answer by schaddem · Jan 26, 2013 at 07:57 AM
http://en.wikipedia.org/wiki/Multithreading_%28software%29#Multithreading
As far as implementing in Unity goes, there's probably no need. Have a look at Coroutines instead.
You're definitely correct in many beginner cases. However, there is a legitimate need if you want to take advantage of other cores for intensive calculations, especially parallel calculations. Coroutines won't get you there.
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How do I call a function in a different CPU core? 2 Answers
How can I get the number of physical cores in the CPU (not logical cores) 1 Answer
What is VFP? 1 Answer
Loading.ReadObject CPU Spike 2 Answers