Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

My game server will have to respond to requests very often, so I consider threading a good option.

But should I use Task class from .NET or have several threads that would execute requests which I would store in a queue (linked list). Which way would be faster?

share|improve this question

closed as off-topic by Seth Battin, Anko, Vaughan Hilts, congusbongus, Josh Petrie Apr 28 at 15:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
The Task class does threading. Its full namespace is System.Threading.Task. It's not clear what your other solution would do differently. –  Seth Battin Apr 26 at 7:29

1 Answer 1

For client Yes. For server not advisable. Loads can be distributed by putting it on queues and let individual servers handle the load. You also have an option to limit the load by assigning what type of task should a server handles. Accounts Server, Game process, Chat etc.

You use thread mainly on client mostly for the purpose of multi-functionality of your games.

Task is a Threading class available in C#. I'm not sure how you differentiate them.

share|improve this answer
    
I already split the server into account/chat/game servers. I'm asking for cases of those individual servers. When they accept a request, should I use a Task or several Threads to handle the response, considering I might need to use file system, which is slow? –  zoran404 May 1 at 16:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.