Thread: Using Thread Priorities

Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1 Using Thread Priorities 
    Banned

    Join Date
    Jul 2008
    Age
    28
    Posts
    5,827
    Thanks given
    1,301
    Thanks received
    197
    Rep Power
    0
    What are Thread priorities? Those of you on Windows have probably used the "Set Priority" feature in Task Manager before; it's pretty much the same thing. For those of you who haven't, heres how it works. You change the priority of a Thread by calling Thread.setPriority(int). Thread.MAX_PRIORITY, Thread.MIN_PRIORITY, and Thread.NORMAL_PRIORITY are all integers that can be used with this method. Thread.MAX_PRIORITY is 10, and Thread.MIN_PRIORITY is 0.

    You still don't know what this could be used for though. You see, when a Thread has less priority than another Thread, the Thread with greater priority has priority access to system resources than the others.

    How can this be applied in your server? In a Winterlove server, you could set the player processing thread to Thread.MAX_PRIORITY, and you could set each Clients Thread to (Thread.NORM_PRIORITY - 1), one less than normal. Now, you could set Threads to do things like autosaving to Thread.MIN_PRIORITY. This would give your processing Thread priority access over everything else in the server, and Client threads priority over autosave Threads.

    Used correctly, Threading priority can be a real benefit. If you're interested, you may want to read this:
    http://download.oracle.com/docs/cd/E...ng/Thread.html
    Reply With Quote  
     


  2. #2  
    Banned

    Join Date
    Dec 2008
    Posts
    2,097
    Thanks given
    1,419
    Thanks received
    732
    Rep Power
    0
    gonna read that link sounds like it could do some good
    Reply With Quote  
     

  3. #3  
    Registered Member
    Sanity's Avatar
    Join Date
    Dec 2008
    Posts
    2,062
    Thanks given
    22
    Thanks received
    362
    Rep Power
    762
    I think I saw this in the 317 server palidino released (his netty one). Someone should see how this works (implement it into a delta server with players or something) and post the results.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Dec 2008
    Posts
    2,097
    Thanks given
    1,419
    Thanks received
    732
    Rep Power
    0
    Quote Originally Posted by Sanity View Post
    I think I saw this in the 317 server palidino released (his netty one). Someone should see how this works (implement it into a delta server with players or something) and post the results.
    would be a good idea I'd like to see how much itll effect performance
    Reply With Quote  
     

  5. #5  
    Registered Member
    Sanity's Avatar
    Join Date
    Dec 2008
    Posts
    2,062
    Thanks given
    22
    Thanks received
    362
    Rep Power
    762
    Quote Originally Posted by Aristos View Post
    would be a good idea I'd like to see how much itll effect performance
    I'll try and talk silabgarza into being the guinea pig lol
    Reply With Quote  
     

  6. #6  
    Donator

    Ecstasy's Avatar
    Join Date
    Sep 2008
    Age
    29
    Posts
    5,031
    Thanks given
    324
    Thanks received
    596
    Rep Power
    843
    Nice one Colby, wasn't thinking of this, I'm gonna implement it into my Animus framework.

    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Sep 2007
    Age
    32
    Posts
    2,396
    Thanks given
    5
    Thanks received
    436
    Rep Power
    902
    very good idea, ive seen this in task manager but never thought of implements it into private servers, could come in handy in future thanks

    I'll try and talk silabgarza into being the guinea pig lol
    u dont need to try and convince him hard, hes been begging for a solution to his lag lol
    Hyperion V2 Martin's Updates.

    Scar says:
    i hate it when it hits your face
    Reply With Quote  
     

  8. #8  
    Registered Member
    Pilldom's Avatar
    Join Date
    Sep 2007
    Posts
    1,298
    Thanks given
    24
    Thanks received
    221
    Rep Power
    164
    Interesting, waiting to see how effective this will be though.
    Attached image
    Reply With Quote  
     

  9. #9  
    isAwesome = true;
    Typhoeus's Avatar
    Join Date
    Nov 2008
    Posts
    815
    Thanks given
    18
    Thanks received
    13
    Rep Power
    246
    Thanks, I learned something by reading this.
    Reply With Quote  
     

  10. #10  
    Registered Member Paketa's Avatar
    Join Date
    Oct 2007
    Posts
    2,681
    Thanks given
    17
    Thanks received
    82
    Rep Power
    680
    Thanks, this is a really helpful post for me, because I always change priorities on task manager and I always wondered if we can do the same thing in java.
    Reply With Quote  
     

Page 1 of 3 123 LastLast

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
  •