ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ForkJoinPool.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ForkJoinPool.java (file contents):
Revision 1.201 by jsr166, Mon Jul 7 19:06:46 2014 UTC vs.
Revision 1.202 by jsr166, Mon Jul 7 20:11:15 2014 UTC

# Line 187 | Line 187 | public class ForkJoinPool extends Abstra
187       * workers to start scanning -- see below.)  Both a successful pop
188       * and poll mainly entail a CAS of a slot from non-null to null.
189       *
190 <     * The pop operation (always performed by owener) is:
190 >     * The pop operation (always performed by owner) is:
191       *   if ((base != top) and
192       *        (the task at top slot is not null) and
193       *        (CAS slot to null))
# Line 393 | Line 393 | public class ForkJoinPool extends Abstra
393       * power-of-two hash table, expanding as needed. The seedIndex
394       * increment ensures no collisions until a resize is needed or a
395       * worker is deregistered and replaced, and thereafter keeps
396 <     * probablility of collision low. We cannot use
396 >     * probability of collision low. We cannot use
397       * ThreadLocalRandom.getProbe() for similar purposes here because
398       * the thread has not started yet, but do so for creating
399       * submission queues for existing external threads.
400       *
401 <     * Deactivation and waiting. Queuing enounters several intrinsic
401 >     * Deactivation and waiting. Queuing encounters several intrinsic
402       * races; most notably that a task-producing thread can miss
403       * seeing (and signalling) another thread that gave up looking for
404       * work but has not yet entered the wait queue.  When a worker
# Line 411 | Line 411 | public class ForkJoinPool extends Abstra
411       * scanning process after successful enqueuing until again stable.
412       * In this state, the worker cannot take/run a task it sees until
413       * it is released from the queue, so the worker itself eventually
414 <     * tries to release itself or any succcessor (see tryRelease).
414 >     * tries to release itself or any successor (see tryRelease).
415       * Otherwise, upon an empty scan, a deactivated worker uses an
416       * adaptive local spin construction (see awaitWork) before
417       * blocking (via park). Note the unusual conventions about
# Line 516 | Line 516 | public class ForkJoinPool extends Abstra
516       *
517       * Helping actions for CountedCompleters do not require tracking
518       * currentJoins: Method helpComplete takes and executes any task
519 <     * with the same root as the task being waited on (prefering local
520 <     * pops to non-local polls). However, this still entails some
521 <     * traversal of completer chains, so is less efficient than using
522 <     * CountedCompleters without explicit joins.
519 >     * with the same root as the task being waited on (preferring
520 >     * local pops to non-local polls). However, this still entails
521 >     * some traversal of completer chains, so is less efficient than
522 >     * using CountedCompleters without explicit joins.
523       *
524       * Compensation does not aim to keep exactly the target
525       * parallelism number of unblocked threads running at any given
# Line 703 | Line 703 | public class ForkJoinPool extends Abstra
703  
704      /**
705       * Queues supporting work-stealing as well as external task
706 <     * submission. See above for dewscriptions and algorithms
706 >     * submission. See above for descriptions and algorithms.
707       * Performance on most platforms is very sensitive to placement of
708       * instances of both WorkQueues and their arrays -- we absolutely
709       * do not want multiple WorkQueue instances or multiple queue
# Line 1418 | Line 1418 | public class ForkJoinPool extends Abstra
1418       *
1419       * @param c incoming ctl value, with total count negative and no
1420       * idle workers.  On CAS failure, c is refreshed and retried if
1421 <     * this holds (otherwise, a new worker is not neeeded).
1421 >     * this holds (otherwise, a new worker is not needed).
1422       */
1423      private void tryAddWorker(long c) {
1424          boolean add = false;
# Line 1609 | Line 1609 | public class ForkJoinPool extends Abstra
1609  
1610      /**
1611       * Scans for and tries to steal a top-level task. Scans start at a
1612 <     * random location, randomly moving on apparentl contention,
1612 >     * random location, randomly moving on apparent contention,
1613       * otherwise continuing linearly until reaching two consecutive
1614       * empty passes over all queues with the same checksum (summing
1615       * each base index of each queue, that moves on each steal), at
# Line 1707 | Line 1707 | public class ForkJoinPool extends Abstra
1707                          (j = pred & SMASK) < ws.length &&
1708                          (v = ws[j]) != null &&        // see if pred parking
1709                          (v.parker == null || v.scanState >= 0))
1710 <                        spins = SPINS;                // continue spinnning
1710 >                        spins = SPINS;                // continue spinning
1711                      else if ((s = w.nsteals) != 0) {
1712                          w.nsteals = 0;                // collect steals
1713                          U.getAndAddLong(this, STEALCOUNT, s);
# Line 1765 | Line 1765 | public class ForkJoinPool extends Abstra
1765       * values).
1766       *
1767       * @param w caller
1768 <     * @param maxTasks if non-sero, the maximum number of other tasks to run
1768 >     * @param maxTasks if non-zero, the maximum number of other tasks to run
1769       * @return task status on exit
1770       */
1771      final int helpComplete(WorkQueue w, CountedCompleter<?> task,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines