Original Post
🔒 Locked
Multithreading questions
Advertisement
i currently have a mmorpg set up using multithreading and the client also uses 1 extra thread to handle data from the server i am wondering if there was any extra lag or issues with multithreading that i haven't heard of or over looked.around how many threads is it usual for a server to have open and opperate stabely at?
Typically a server uses threads to send and receive data in the background. For example, the main thread of your multi-player API pushes outgoing data into a queue and the sender thread constantly pops bits out of the queue and sends the data in the background. A receiving thread listens for incoming data in the background and pushes it into another queue for use by your main thread. Just be sure and wrap your push/pop operations in a mutex.
Threads wont't cause a noticable amount of network lag because the network is always going to be much slower than the CPU. On the other hand, if you don't use multiple threads, your code may run slower because it has to either wait or poll for network data. Using the queue approach, there is no waiting in your main thread.
Threads wont't cause a noticable amount of network lag because the network is always going to be much slower than the CPU. On the other hand, if you don't use multiple threads, your code may run slower because it has to either wait or poll for network data. Using the queue approach, there is no waiting in your main thread.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement