Update of /cvsroot/freenet/freenet/src/freenet/thread In directory sc8-pr-cvs1:/tmp/cvs-serv27806/thread
Modified Files: QThreadFactory.java Log Message: 6212: Niklas: better catching for bad DSASignatures - Backout unneeded logging change from 6211 Brandon: 2 more QThreadFactory changes - Don't have every idle thread loop around itself every 200 ms, it isn't needed - Don't delete threads all the way down to IDEAL_AVAILABLE_RATIO only delete to MAXIMUM_AVAILABLE_RATIO reduces thread flux from > 5000/hr to < 1000/hr Edward: Just a whitespace change Index: QThreadFactory.java =================================================================== RCS file: /cvsroot/freenet/freenet/src/freenet/thread/QThreadFactory.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- QThreadFactory.java 28 Sep 2003 18:05:31 -0000 1.38 +++ QThreadFactory.java 29 Sep 2003 06:56:34 -0000 1.39 @@ -88,14 +88,6 @@ countLock.snap(snap); // start with a maximal allowed value. allowed = (int)(snap.active * MAXIMUM_AVAILABLE_RATIO); - if ( snap.available > 3 * MINIMUM_AVAILABLE_ABS && - snap.available > allowed ) { - // if we are above that, and above an absolute threshold, - // set target lower, but not too low. - allowed = - Math.max((int) (snap.active * IDEAL_AVAILABLE_RATIO), - 2 * MINIMUM_AVAILABLE_ABS); - } // Repeatedly remove a thread from the stack and signal it to die. // But if all of the threads have meanwhile started jobs, then // do nothing, and the loop will terminate with snap.available == 0 @@ -106,10 +98,11 @@ // but it can never make headLock.pop() be null. headLock.pop().die(); } + // Let there be up to maximum threads sitting + // around, I think this will reduce thread flux + // a lot which should help CPU usage further allowed = - Math.max((int) (snap.active * IDEAL_AVAILABLE_RATIO), - Math.max(allowed, // allowed must not decrease. - 2 * MINIMUM_AVAILABLE_ABS)); + Math.max((int) (snap.active * MAXIMUM_AVAILABLE_RATIO), allowed); } if (logDEBUG && doLog) Core.logger.log(this,"Thread creation thread past destruction loop" + @@ -212,7 +205,11 @@ synchronized (this) { while (alive.state() && job == null) { try { - this.wait(200); + //There is no need to timeout this wait, getThread() + //is the only way to get a thread, and it does + //thread.start() which will awaken the thread, and + //thread.die() also awakens the thread. + this.wait(); } catch (InterruptedException e) {} } _______________________________________________ cvs mailing list [EMAIL PROTECTED] http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs