Sign in to follow this  

Async Non-Blocking Vs. Non-Blocking

This topic is 4863 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
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

This topic is 4863 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this