I'm still wondering what multithreading is and how to do it. o_o
Multithreading is basically the idea of having multiple processes running simultaneously. Unlike a single-threaded process, you run into a lot of problems when you start multithreading because they act like completely separate processes. What happens if one thread needs to read some RAM and another thread wants to write to it? Or even worse, two things want to write to one place. This is called a "race condition" and it leads to very unpredictable behavior. They involve "atomic" operations, which cannot be interrupted and are effectively simultaneous in the eyes of the CPU and any other threads running on it. Something is called "threadsafe" if it will not do horrible things if other threads are involved.
So multithreading seeks to eliminate race conditions either by using locks, in which a thread asks "does anybody else need this?" before they go on. But locks are slow, dangerous, and have many other problems. If two separate threads want a lock that the other has, it's a deadlock, and the threads wait forever. If a thread locks something twice, some implementations can cause it to be locked forever. Any kind of bug is extremely hard to replicate because they are dependent on exactly what the rest of the computer is doing. And lastly, they just add overhead to everything because a thread asks for a lock every time it tries to access something.
So there has been a lot of research into using "non-blocking" algorithms. These usually include CPU instructions like CAS (Compare And Swap, checks to see if the register/RAM is equal to A, if it is, then it sets it to B). There are a few algorithms that don't even need specific atomic operations, but those need to be specifically implemented and are very limited.
On that note, it's always a good idea to use multithreading only when necessary. For example, feeding data to the GPU should only be done by one thread, just use a simple queue to feed data to it. Queues are threadsafe
if properly implemented,
Intel's TBB has an example of this.