Documentation of 'edu.rit.pj.ParallelTeam' Java class
ParallelTeam
edu.rit.pj

Class ParallelTeam



  • public class ParallelTeam
    extends java.lang.Object
    Class ParallelTeam provides a team of threads for executing a ParallelRegion in parallel.

    To execute a parallel region, create a ParallelTeam object; create an instance of a concrete subclass of class ParallelRegion; and pass this instance to the parallel team's execute() method. For further information, see class ParallelRegion.

    • Constructor Summary

      Constructors 
      Constructor and Description
      ParallelTeam()
      Construct a new parallel team with the default number of threads.
      ParallelTeam(int K)
      Construct a new parallel team with the given number of threads.
    • Constructor Detail

      • ParallelTeam

        public ParallelTeam()
        Construct a new parallel team with the default number of threads. If the "pj.nt" Java property is specified, that property gives the default number of threads, which must be an integer greater than or equal to 1. If the "pj.nt" Java property is not specified, the default number of threads is the value returned by the Runtime.availableProcessors() method. You can specify the default number of threads on the Java command line like this:
             java -Dpj.nt=4 . . .
         
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if the "pj.nt" property value is not an integer greater than or equal to 1.
      • ParallelTeam

        public ParallelTeam(int K)
        Construct a new parallel team with the given number of threads.
        Parameters:
        K - Number of threads.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if K is less than 1.
    • Method Detail

      • execute

        public final void execute(ParallelRegion theRegion)
                           throws java.lang.Exception
        Execute the given parallel region.
        Parameters:
        theRegion - Parallel region.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theRegion is null.
        java.lang.IllegalStateException - (unchecked exception) Thrown if this parallel team is already executing a parallel region. Thrown if theRegion is already being executed by a parallel team.
        java.lang.Exception - Exception thrown by the parallel region's start(), run(), or finish() methods.
      • isExecutingInParallel

        public final boolean isExecutingInParallel()
        Determine if this parallel team is executing a parallel region.
        Returns:
        True if this parallel team is executing a parallel region, false otherwise.
      • region

        public final ParallelRegion region()
        Returns the parallel region of code that this parallel team is executing.
        Returns:
        Parallel region.
        Throws:
        java.lang.IllegalStateException - (unchecked exception) Thrown if this parallel team is not executing a parallel region.
      • getThreadCount

        public final int getThreadCount()
        Determine the number of threads in this parallel team.
        Returns:
        Number of threads in the team.
      • getDefaultThreadCount

        public static int getDefaultThreadCount()
        Determine the default number of threads for a parallel team. If the "pj.nt" Java property is specified, that property gives the default number of threads, which must be an integer greater than or equal to 1. If the "pj.nt" Java property is not specified, the default number of threads is the value returned by the Runtime.availableProcessors() method. You can specify the default number of threads on the Java command line like this:
             java -Dpj.nt=4 . . .
         
        Returns:
        Default number of threads for a parallel team.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if the "pj.nt" property value is not an integer greater than or equal to 1.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.