Thread: which would be best?

Results 1 to 6 of 6
  1. #1 which would be best? 
    Banned

    Join Date
    Jul 2008
    Age
    28
    Posts
    5,827
    Thanks given
    1,301
    Thanks received
    197
    Rep Power
    0
    So we're starting out with a basic winterlove type server. Which of the following would be the fastest? (Disregarding memory consumption or CPU time)

    Code:
    #1:
    We do away with the "main" thread for processing, and when a "incoming" thread receives a full packet, it acquires a lock on all players and processes the packet.
    
    Now, the main thread can focus on updating the players and not IO or tending to packets.

    Code:
    #2:
    We make an "incoming" thread to handle incoming data, and it reads it into a byte array. Now when the "main" thread processes packets, it has the data already instead of having to deal with IO.
    Reply With Quote  
     

  2. #2  
    Sir Rivera
    Guest
    I think option 2 would be the best.
    Because it will immediately start with receiving information when it's needed.

    And option 2 might cause lagg.
    Because it can't do anything with the Player thread.
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Jul 2008
    Age
    28
    Posts
    5,827
    Thanks given
    1,301
    Thanks received
    197
    Rep Power
    0
    Quote Originally Posted by Sir Rivera View Post
    I think option 2 would be the best.
    Because it will immediately start with receiving information when it's needed.

    And option 2 might cause lagg.
    Because it can't do anything with the Player thread.
    No matter what you do, its going to be the same on the user-end, I'm just looking to get petter cycle times out of it.
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    May 2009
    Posts
    303
    Thanks given
    0
    Thanks received
    4
    Rep Power
    341
    number 2
    thiefmn6092 has not made any friends yet
    Reply With Quote  
     

  5. #5  
    Community Veteran


    Join Date
    Jan 2008
    Posts
    2,659
    Thanks given
    494
    Thanks received
    627
    Rep Power
    980
    This doesn't make sense.

    The main thread only listens for incoming connections and accepts them. After it accepts a client, it creates a new thread to handle it. It's the newly created thread that handles the client, not the main thread.
    Reply With Quote  
     

  6. #6  
    Banned

    Join Date
    Jul 2008
    Age
    28
    Posts
    5,827
    Thanks given
    1,301
    Thanks received
    197
    Rep Power
    0
    Quote Originally Posted by Realm View Post
    This doesn't make sense.

    The main thread only listens for incoming connections and accepts them. After it accepts a client, it creates a new thread to handle it. It's the newly created thread that handles the client, not the main thread.
    The processing thread..

    Sorry i dont start my main thread from the listening thread, so for me the main one has nothing to do with listening.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •