Skip to main content
gamedev.net
🔒 Locked

Multithreading questions

Started by Solance 2 replies 550+ views
Original Post
Solance
Solance
is multithreading known to be very laggy? is it the best route to go on servers?
Kylotan
Kylotan
No, it's not, and it depends what sort of servers and what they are trying to achieve. I think you could do with asking a more specific question.
Solance
Solance
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?
crizo
crizo
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.
CosmicBee - Software With Buzz

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.