Multi-Threading and Load Balancing Compiled by Paul TaylorCSE3AGR Stolen mainly from Orion Granatir...
-
Upload
darlene-johns -
Category
Documents
-
view
214 -
download
0
Transcript of Multi-Threading and Load Balancing Compiled by Paul TaylorCSE3AGR Stolen mainly from Orion Granatir...
Multi-Threading and Load Balancing
Compiled by Paul TaylorCSE3AGRStolen mainly from Orion Granatir
http://www.gamasutra.com/php-bin/article_display.php?story=4006
What changed?
• Single Thread Computer games have been used since day 0
• The person to blame is Gordon Moore*
* Not really it just feels good to blame someone!
Moore’s Law
• http://en.wikipedia.org/wiki/File:Transistor_Count_and_Moore%27s_Law_-_2008.svg
•The Complexity of IC’s will go up exponentially•We mutilated this into CPU speed will increase expo.•This all F*#ked up a few years ago when we started pushing the boundaries of transistor miniaturisation•To keep the processing increase we went with Multi core processors
Mutexs and Semaphores
• A Semaphore is like usingMultiple tokens (it retains a value)• Critical Sections are fastest, but limited to one
process• Mutexs are slower, but globally accessible• Semaphores are great for things like allocating
your memory buffers
Race Conditions
• The ‘race’ is a term for when your code expects threads to return in order, and they don’t!!!
Network Code Example
• The Main thread would then need to wait for all Network threads to finish before it resets the NetworkUpdateEvent and continues
• How would you solve this?