So far I've only found one place that multithreading is critical and that's in a game's network code. Imagine that your game is drawing 25 frames a second. Most of that time will be spent rendering, which means that nearly 40 milliseconds is spent doing things other than networking . So imagine if a message arrives from the internet just as the game starts rendering. If the same thing happens on the other computer then we're looking at an automatic addition of 80ms to the ping time.
Threads have priority levels and the higher priority threads use more CPU time.
Unless told to, threads don't care what other threads are doing, so it's quite possible that two threads might try to use the same piece of data at the same time and never know that they were messing with each other's stuff, leading to potential disaster. A thread that plays nicely with the other threads and does not try to muck with a critical section while another thread is using it is refered to as thread safe . Let's start by designing a thread class. This first version of the class will not be thread safe. The declaration looks as follows.