Jump to content
  • Advertisement
Sign in to follow this  
Milonius

Async Non-Blocking Vs. Non-Blocking

This topic is 5076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Howdy, I wouldn't mind some opinions on the topic of Async Non-Blocking Vs. Non-Blocking sockets for a server application. Pro's or cons, and some theory on the two would suit me perfectly. The server I will be designing will be massively multiplayer, and I have plans of implementing a priority queue for incoming / outgoing messages. Comments are appreciated :). This is my plan so far: - Threaded Listening Socket through a encapsulation class - Threaded Client socket for each player online if the max threads per process will permit (rough number anyone?) - 2 Queues between the game code and network code. One queue for outgoing messages, the other for incoming messages. thanks for you time. :D

Share this post


Link to post
Share on other sites
Advertisement
Thread-per-player tends to be a very bad idea. OSes simply aren't set up for massive numbers of threads, and the thread scheduler will slow things down. Fiber-per-player might work a little better (if you're on Win32). Otherwise, you may want to consider having a thread per X number of players.

Share this post


Link to post
Share on other sites
Why a thread per X number of players? You're probably bound on synchronization of world updates, and when you're not bound on that, bound on memory latency (rather than processing). Multiple threads only make sense if you're purely CPU bound, so that multiple CPUs can make your application run faster.

Multiple threads can also be used to emulate asynchronous APIs, if no native asynchronous APIs are available, but then the threads should be hidden from the rest of the application, so those aren't as bad.

Share this post


Link to post
Share on other sites
Why not write your own scheduler ?

Take a look at tinyOS, they use a fifo queue for short jobs/task. Maybe that fits into your design.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!