Book Image

Mastering Concurrency Programming with Java 8

By : Javier Fernández González
Book Image

Mastering Concurrency Programming with Java 8

By: Javier Fernández González

Overview of this book

Concurrency programming allows several large tasks to be divided into smaller sub-tasks, which are further processed as individual tasks that run in parallel. All the sub-tasks are combined together once the required results are achieved; they are then merged to get the final output. The whole process is very complex. This process goes from the design of concurrent algorithms to the testing phase where concurrent applications need extra attention. Java includes a comprehensive API with a lot of ready-to-use components to implement powerful concurrency applications in an easy way, but with a high flexibility to adapt these components to your needs. The book starts with a full description of design principles of concurrent applications and how to parallelize a sequential algorithm. We'll show you how to use all the components of the Java Concurrency API from basics to the most advanced techniques to implement them in powerful concurrency applications in Java. You will be using real-world examples of complex algorithms related to machine learning, data mining, natural language processing, image processing in client / server environments. Next, you will learn how to use the most important components of the Java 8 Concurrency API: the Executor framework to execute multiple tasks in your applications, the phaser class to implement concurrent tasks divided into phases, and the Fork/Join framework to implement concurrent tasks that can be split into smaller problems (using the divide and conquer technique). Toward the end, we will cover the new inclusions in Java 8 API, the Map and Reduce model, and the Map and Collect model. The book will also teach you about the data structures and synchronization utilities to avoid data-race conditions and other critical problems. Finally, the book ends with a detailed description of the tools and techniques that you can use to test a Java concurrent application.
Table of Contents (18 chapters)
Mastering Concurrency Programming with Java 8
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Index

A

  • advanced search
    • about / The second approach – advanced search
    • ConcurrentObjectAccumulator class / The ConcurrentObjectAccumulator class
  • alternatives
    • implementing, with concurrent programming / Implementation of alternatives with concurrent programming
    • k-nearest neighbors' algorithm / The k-nearest neighbors' algorithm
  • Amazon product co-purchasing network metadata
    • URL / The third example – the merge sort algorithm, The first example – searching data without an index
    • about / The first example – searching data without an index
  • Amdahl's law
    • about / Step 5 – tuning
  • AssignmentTask class
    • attributes / Two tasks for the Fork/Join framework – AssignmentTask and UpdateTask
  • asynchronous message passing
    • about / The main class of the document clustering application
  • atomic operation
    • about / Atomic operations and variables
  • atomic variable
    • about / Atomic operations and variables
  • attributes, NewsBuffer class
    • LinkedBlockingQueue / The common parts
    • ConcurrentHashMap / The common parts

B

  • Bank Marketing dataset
    • about / First example – the k-nearest neighbors algorithm
    • URL / First example – the k-nearest neighbors algorithm, The first example – a numerical summarization application
  • base classes, social network
    • about / Base classes
    • Person class / The Person class, The PersonPair class
    • DataLoader class / The DataLoader class
  • basic classes
    • Product class / The Product class
    • Review class / The Review class
    • ProductLoader class / The ProductLoader class
  • basic concurrency classes
    • about / Basic concurrency classes
    • Thread class / Basic concurrency classes
    • Runnable interface / Basic concurrency classes
    • ThreadLocal class / Basic concurrency classes
    • ThreadFactory interface / Basic concurrency classes
  • basic concurrency concepts
    • about / Basic concurrency concepts
    • concurrency, versus parallelism / Concurrency versus parallelism
    • synchronization / Synchronization
    • immutable object / Immutable object
    • atomic operation / Atomic operations and variables
    • atomic variable / Atomic operations and variables
    • shared memory / Shared memory versus message passing
    • message passing / Shared memory versus message passing
  • basic search
    • defining / The first approach – basic search
    • ConcurrentStringAcumulator class / The ConcurrentStringAccumulator class
  • best-matching algorithm
    • about / First example – a best-matching algorithm for words
    • common classes / The common classes
    • serial version / A best-matching algorithm – the serial version
    • first concurrent version / A best-matching algorithm – the first concurrent version
    • Word exists algorithm / The word exists algorithm – a serial version
    • concurrent version / The word exists algorithm – the concurrent version
    • solutions, comparing / Comparing the solutions
    • for words / A best-matching algorithm for words
  • best-matching algorithms
    • and word exists algorithm, comparing / Best-matching algorithms
  • blocking data structure
    • about / The log system
  • blocking operations
    • methods, implementing / Other methods of interest

C

  • cache system
    • CacheItem class / The cache system
    • CleanCacheTask class / The cache system
    • ParallelCache class / The cache system
  • Callable and Future interfaces
    • defining / Introducing the Callable and Future interfaces
  • Callable interface
    • defining / The Callable interface
  • Census-Income KDD dataset
    • about / The second example – a data filtering algorithm
    • URL / The second example – a data filtering algorithm
    • references / Common parts
  • char sequence
    • about / First example – a best-matching algorithm for words
  • chromosomes
    • about / The second example – a genetic algorithm
  • City Distance Datasets
    • URL / The second example – a genetic algorithm, Comparing the two solutions
  • client/server environment
    • interest methods / Other methods of interest
  • client/server model
    • about / The second example – concurrency in a client/server environment
  • client part
    • about / The client part
    • ConcurrentClient class / The client part
    • MultipleConcurrentClient class / The client part
  • clustering algorithm
    • about / The second example – creating an inverted index for a collection of documents
  • Clustering system
    • elements, defining / The Clustering system
  • coarse-grained granularity
    • about / Synchronization
  • Coffman's conditions
    • mutual exclusion / Deadlock
    • hold and wait condition / Deadlock
    • no pre-emption / Deadlock
    • circular waiting / Deadlock
  • collect() method
    • about / The collect() method
    • parameters / The collect() method, The first approach – basic search
    • arguments / The collect() method
  • Collectors factory class
    • methods / The collect() method
  • command classes
    • about / The command classes
    • ConcurrentCommand class / The ConcurrentCommand class
    • concrete commands / Concrete commands
  • common classes, genetic algorithm
    • about / Common classes
    • Individual class / The Individual class
    • GeneticOperators class / The GeneticOperators class
  • common classes, inverted index
    • Document class / The Document class
    • DocumentParser class / The DocumentParser class
  • common classes, k-means clustering algorithm
    • about / The common classes
    • VocabularyLoader class / The VocabularyLoader class
    • Word class / The Word, Document, and DocumentLoader classes
    • Document class / The Word, Document, and DocumentLoader classes
    • DocumentLoader class / The Word, Document, and DocumentLoader classes
    • DistanceMeasurer class / The DistanceMeasurer class
    • DocumentCluster class / The DocumentCluster class
  • common classes, keyword extraction algorithm
    • about / Common classes
    • Word class / The Word class
    • Keyword class / The Keyword class
    • Document class / The Document class
    • DocumentParser class / The DocumentParser class
  • common classes, recommendation system
    • about / Common classes
    • ProductReview class / The ProductReview class
    • ProductRecommendation class / The ProductRecommendation class
  • compare-and-swap (CAS)
    • about / Synchronization
  • CompletableFuture class
    • main() method / The main() method
  • components, concurrency API
    • about / The k-nearest neighbors' algorithm
    • threads / The k-nearest neighbors' algorithm
    • Fork/Join framework / The k-nearest neighbors' algorithm, Building an inverted index of a collection of documents
    • streams / The k-nearest neighbors' algorithm, Building an inverted index of a collection of documents
    • thread / Building an inverted index of a collection of documents
    • defining / A best-matching algorithm for words, A keyword extraction algorithm
  • components, concurrent server
    • defining / Extra components of the concurrent server
    • status command / The status command
    • cache system / The cache system
    • log system / The log system
    • two solutions, comparing / Comparing the two solutions
  • components, document clustering application
    • Reader system / An example of a document clustering application
    • Indexer system / An example of a document clustering application
    • Mapper system / An example of a document clustering application
    • Clusterer system / An example of a document clustering application
  • components, k-nearest neighbors algorithm
    • train dataset / First example – the k-nearest neighbors algorithm
    • distance metric / First example – the k-nearest neighbors algorithm
    • test dataset / First example – the k-nearest neighbors algorithm
  • components, log system
    • LogTask / The log system
    • Logger / The log system
  • concurrency
    • versus parallelism / Concurrency versus parallelism
  • concurrency applications
    • monitoring / Monitoring concurrency applications
    • Overview tab / The Overview tab
    • Monitor tab / The Monitor tab
    • Threads tab / The Threads tab
    • Sampler tab / The Sampler tab
    • Profiler tab / The Profiler tab
    • testing / Testing concurrency applications
    • testing, with MultithreadedTC / Testing concurrent applications with MultithreadedTC
    • testing, with Java Pathfinder / Testing concurrent applications with Java Pathfinder
  • concurrency design patterns
    • about / Concurrency design patterns
    • signaling / Signaling
    • rendezvous / Rendezvous
    • mutex / Mutex
    • Multiplex design pattern / Multiplex
    • barrier pattern / Barrier
    • double-checked locking / Double-checked locking
    • read-write lock / Read-write lock
    • thread pool / Thread pool
    • thread local storage / Thread local storage
  • concurrency objects
    • monitoring / Monitoring concurrency objects
    • thread, monitoring / Monitoring a thread
    • lock, monitoring / Monitoring a lock
    • executor, monitoring / Monitoring an executor
    • Fork/Join framework, monitoring / Monitoring the Fork/Join framework
    • Phaser, monitoring / Monitoring a Phaser
    • stream, monitoring / Monitoring a stream
  • concurrent data structures
    • about / Concurrent data structures, Concurrent data structures
    • blocking data structures / Concurrent data structures, Other methods of interest, Blocking and non-blocking data structures
    • non-blocking data structures / Concurrent data structures, Other methods of interest, Blocking and non-blocking data structures
    • ConcurrentLinkedDeque / Concurrent data structures
    • ConcurrentLinkedQueue / Concurrent data structures
    • LinkedBlockingDeque / Concurrent data structures
    • LinkedBlockingQueue / Concurrent data structures
    • PriorityBlockingQueue / Concurrent data structures
    • ConcurrentSkipListMap / Concurrent data structures
    • ConcurrentHashMap / Concurrent data structures
    • AtomicLong / Concurrent data structures
    • AtomicBoolean / Concurrent data structures
    • AtomicInteger / Concurrent data structures
    • AtomicReference / Concurrent data structures
    • defining / Blocking and non-blocking data structures
    • interfaces / Interfaces
  • ConcurrentStatistics class
    • job information, from subscribers / Job information from subscribers
    • Age data, from subscribers / Age data from subscribers
    • Marital data, from subscribers / Marital data from subscribers
    • Campaign data, from nonsubscribers / Campaign data from nonsubscribers
    • multiple data filter / Multiple data filter
    • duration data, from nonsubscribers / Duration data from nonsubscribers
    • people between 25 and 50 / People aged between 25 and 50
  • concurrent version, data filtering algorithm
    • about / The concurrent version
    • TaskManager class / The TaskManager class
    • IndividualTask class / The IndividualTask class
    • ListTask class / The ListTask class
    • ConcurrentSearch class / The ConcurrentSearch class
    • ConcurrentMain class / The ConcurrentMain class
  • concurrent version, genetic algorithm
    • about / The concurrent version
    • SharedData class / The SharedData class
    • GeneticPhaser class / The GeneticPhaser class
    • ConcurrentGeneticTask class / The ConcurrentGeneticTask class
    • ConcurrentGeneticAlgorithm class / The ConcurrentGeneticAlgorithm class
    • ConcurrentMain class / The ConcurrentMain class
  • concurrent version, k-means clustering algorithm
    • about / The concurrent version
    • AssignmentTask / Two tasks for the Fork/Join framework – AssignmentTask and UpdateTask
    • UpdateTask / Two tasks for the Fork/Join framework – AssignmentTask and UpdateTask
    • ConcurrentKMeans class / The ConcurrentKMeans class
    • ConcurrentMain class / The ConcurrentMain class
  • concurrent version, keyword extraction algorithm
    • about / The concurrent version
    • KeywordExtractionTask class / The KeywordExtractionTask class
    • ConcurrentKeywordExtraction class / The ConcurrentKeywordExtraction class
  • concurrent version, merge sort algorithm
    • about / The concurrent version
    • MergeSortTask class / The MergeSortTask class
    • ConcurrentMergeSort class / The ConcurrentMergeSort class
    • ConcurrentMetaData class / The ConcurrentMetaData class
  • concurrent version, numerical summarization application
    • about / The concurrent version
    • ConcurrentDataLoader class / The ConcurrentDataLoader class
    • ConcurrentStatistics class / The ConcurrentStatistics class
    • ConcurrentMain class / The ConcurrentMain class
  • concurrent version, social network
    • CommonPersonMapper class / The CommonPersonMapper class
    • ConcurrentSocialNetwork class / The ConcurrentSocialNetwork class
    • ConcurrentMain class / The ConcurrentMain class
  • concurrent version, word exists algorithm
    • about / The word exists algorithm – the concurrent version
    • ExistBasicTasks class / The ExistBasicTasks class
    • ExistBasicConcurrentCalculation class / The ExistBasicConcurrentCalculation class
    • ExistBasicConcurrentMain class / The ExistBasicConcurrentMain class
  • control synchronization
    • about / Synchronization
  • critical section
    • about / Synchronization

D

  • DAO (Data Access Object)
    • about / Client/server – serial version
  • data
    • collecting, streams used / Using streams to collect data
    • searching, without index / The first example – searching data without an index
  • data access synchronization
    • about / Synchronization
  • data decomposition
    • about / Step 2 – design
  • data filtering algorithm
    • about / The second example – a data filtering algorithm
    • common parts / Common parts
    • serial version / The serial version
    • concurrent version / The concurrent version
    • two versions, comparing / Comparing the two versions
  • data search, without index
    • basic classes / Basic classes
    • basic search / The first approach – basic search
    • advanced search / The second approach – advanced search
    • serial implementation, of example / A serial implementation of the example
    • implementations, comparing / Comparing the implementations
  • deque
    • about / BlockingDeque
  • design concurrent algorithms
    • tips and tricks / Tips and tricks to design concurrent algorithms
  • design pattern
    • about / Concurrency design patterns
  • DF (document frequency)
    • about / First example – a keyword extraction algorithm
  • document clustering application
    • example / An example of a document clustering application
    • main class / The main class of the document clustering application
    • testing / Testing our document clustering application

E

  • efficiency
    • about / Conclusion
  • Euclidean distance
    • about / First example – the k-nearest neighbors algorithm, The first example – the k-means clustering algorithm
  • Executor framework
    • about / Java concurrency API, Executors
    • Executor interface / Executors
    • ExecutorService interface / Executors
    • ThreadPoolExecutor / Executors
    • ScheduledThreadPoolExecutor / Executors
    • Executors / Executors
    • Callable interface / Executors
    • Future interface / Executors
  • executor framework
    • components / Basic components of the executor framework
    • Executor interface / Basic components of the executor framework
    • ExecutorService interface / Basic components of the executor framework
    • ThreadPoolExecutor class / Basic components of the executor framework
    • Executors class / Basic components of the executor framework
  • executors
    • defining / An introduction to executors, Advanced characteristics of executors, Additional information about executors
    • characteristics / Basic characteristics of executors, Advanced characteristics of executors
    • tasks, cancelling / Cancellation of tasks
    • task execution, scheduling / Scheduling the execution of tasks
    • executor methods, overriding / Overriding the executor methods
    • initialization parameters, changing / Changing some initialization parameters
  • Executors class
    • methods / Other methods of interest

F

  • Facebook dataset
    • URL / The third example – common contacts in a social network
  • Factory pattern
    • about / Concurrency design patterns
  • filtering data algorithm
    • about / A filtering data algorithm
  • fine-grained granularity
    • about / Synchronization
  • finish criteria
    • about / The second example – a genetic algorithm
  • First-In-First-Out (FIFO)
    • about / BlockingQueue
  • first concurrent version, best-matching algorithm
    • about / A best-matching algorithm – the first concurrent version
    • BestMatchingBasicTask class / The BestMatchingBasicTask class
    • BestMatchingBasicConcurrentCalculation class / The BestMatchingBasicConcurrentCalculation class
  • fitness function
    • about / The second example – a genetic algorithm
  • Fork/Join framework
    • about / The Fork/Join framework
    • ForkJoinPool / The Fork/Join framework
    • ForkJoinTask / The Fork/Join framework
    • ForkJoinWorkerThread / The Fork/Join framework
    • defining / An introduction to the Fork/Join framework
    • examples / An introduction to the Fork/Join framework
    • characteristics / Basic characteristics of the Fork/Join framework
    • limitations / Limitations of the Fork/Join framework
    • components / Components of the Fork/Join framework
    • methods / Other methods of the Fork/Join framework
  • full document query
    • about / The first approach – full document query
    • basicMapper() method / The basicMapper() method
    • Token class / The Token class
    • QueryResult class / The QueryResult class
  • Future interface
    • defining / The Future interface

G

  • generation
    • about / The second example – a genetic algorithm
  • genetic algorithm
    • about / The second example – a genetic algorithm, A genetic algorithm
    • common classes / Common classes
    • serial version / The serial version
    • concurrent version / The concurrent version
    • two solutions, comparing / Comparing the two solutions
    • conclusions / Conclusions
  • GeneticOperators class
    • methods / The GeneticOperators class
  • granularity
    • about / Synchronization
  • Gustafson-Barsis' law
    • about / Step 5 – tuning

H

  • handouts
    • URL / A genetic algorithm
  • HTML file
    • generating, with results / The third approach – generating an HTML file with the results
    • ContentMapper class / The ContentMapper class

I

  • IDF (inverse document frequency)
    • about / First example – a keyword extraction algorithm
  • immutable object
    • about / Immutable object
  • individuals
    • about / The second example – a genetic algorithm
  • information retrieval search tool
    • about / The second example – an information retrieval search tool
    • URL / The second example – an information retrieval search tool
    • reduction operation / An introduction to the reduction operation
    • full document query / The first approach – full document query
    • reduced document query / The second approach – reduced document query
    • HTML file, generating with results / The third approach – generating an HTML file with the results
    • inverted index, preloading / The fourth approach – preloading the inverted index
    • own executor, using / The fifth approach – using our own executor
    • ConcurrentData class / Getting data from the inverted index – the ConcurrentData class
    • number of words, obtaining in file / Getting the number of words in a file
    • average tfxidf value, obtaining in file / Getting the average tfxidf value in a file
    • maximum and minimum tfxidf values, obtaining in file / Getting the maximum and minimum tfxidf values in the index
    • ConcurrentMain class / The ConcurrentMain class
    • serial version / The serial version
    • solutions, comparing / Comparing the solutions
  • interfaces, concurrent data structures
    • about / Interfaces
    • BlockingQueue / BlockingQueue
    • BlockingDeque / BlockingDeque
  • inverted index
    • creating, for document collection / The second example – creating an inverted index for a collection of documents
    • about / The second example – creating an inverted index for a collection of documents, The second example – an information retrieval search tool
    • common classes / Common classes
    • serial version / The serial version
    • task per document / The first concurrent version – a task per document
    • multiple documents per task / The second concurrent version – multiple documents per task
    • solutions, comparing / Comparing the solutions
    • methods of interest / Other methods of interest
    • preloading / The fourth approach – preloading the inverted index
    • ConcurrentFileLoader class / The ConcurrentFileLoader class
    • building, of collection of documents / Building an inverted index of a collection of documents
    • searching / Searching an inverted index
  • InvertedIndexTask class
    • internal attributes / The InvertedIndexTask class

J

  • Java collections framework (JCF)
    • about / Blocking and non-blocking data structures
  • Java concurrency API
    • about / Java concurrency API
    • basic concurrency classes / Basic concurrency classes
    • synchronization mechanisms / Synchronization mechanisms
    • Executor framework / Executors
    • Fork/Join framework / The Fork/Join framework
  • Java memory model
    • about / The Java memory model
  • Java Pathfinder
    • concurrent applications, testing with / Testing concurrent applications with Java Pathfinder
    • installing / Installing Java Pathfinder
    • running / Running Java Pathfinder
  • Java Virtual Machine (JVM)
    • about / The Java memory model, The ConcurrentKeywordExtraction class
  • JMH framework
    • URL / Comparing the solutions, Comparing the two solutions, Comparing the solutions, Comparing the two solutions, Comparing the two solutions, Comparing the solutions, Comparing the two versions, Comparing the two versions, Comparing the two versions, Comparing the solutions, Comparing the implementations, Comparing the two versions, Comparing the two versions
  • JPF
    • URL / Running Java Pathfinder
    • about / Running Java Pathfinder
  • JPF plugin, for Eclipse
    • URL / Installing Java Pathfinder
    • references / Installing Java Pathfinder

K

  • k-means clustering algorithm
    • about / The first example – the k-means clustering algorithm, A k-means clustering algorithm
    • limitations / The first example – the k-means clustering algorithm
    • common classes / The common classes
    • serial version / The serial version
    • concurrent version / The concurrent version
    • solutions, comparing / Comparing the solutions
  • k-nearest neighbors algorithm
    • defining / First example – the k-nearest neighbors algorithm
    • serial version / K-nearest neighbors – serial version
    • fine-grained concurrent version / K-nearest neighbors – a fine-grained concurrent version
    • coarse-grained concurrent version / K-nearest neighbors – a coarse-grained concurrent version
    • solutions, comparing / Comparing the solutions
  • keyword extraction algorithm
    • about / First example – a keyword extraction algorithm, A keyword extraction algorithm
    • common classes / Common classes
    • serial version / The serial version
    • concurrent version / The concurrent version
    • two solutions, comparing / Comparing the two solutions
  • KeywordExtractionTask class
    • attributes / The KeywordExtractionTask class
  • Kn57 dataset
    • about / The Kn57 dataset

L

  • Lau15 dataset
    • about / The Lau15 dataset
  • Levenshtein distance
    • about / First example – a best-matching algorithm for words
    • URL / First example – a best-matching algorithm for words
  • LINQ (Language-Integrated Query)
    • about / An introduction to streams

M

  • machine-learning algorithm
    • about / An introduction to executors
  • mechanisms, for avoiding deadlocks
    • ignore / Deadlock
    • detection / Deadlock
    • prevention / Deadlock
    • avoidance / Deadlock
  • Mercurial
    • references / Installing Java Pathfinder
  • merge sort algorithm
    • about / The third example – the merge sort algorithm
    • shared classes / Shared classes
    • serial version / The serial version
    • concurrent version / The concurrent version
    • two versions, comparing / Comparing the two versions
  • message passing
    • about / Shared memory versus message passing
  • message passing techniques
    • synchronous / Big-block synchronization mechanisms
    • asynchronous / Big-block synchronization mechanisms
  • methodology, design concurrent algorithms
    • about / A methodology to design concurrent algorithms
    • starting point / The starting point – a sequential version of the algorithm
    • analysis / Step 1 – analysis
    • design / Step 2 – design
    • implementation / Step 3 – implementation
    • testing / Step 4 – testing
    • tuning / Step 5 – tuning
    • conclusion / Conclusion
  • methods
    • used, for registering participant / Registration and deregistration of participants
    • used, for synchronizing phase change / Synchronizing phase changes
  • methods, ForkJoinTask class
    • fork() method / Basic characteristics of the Fork/Join framework
    • join() method / Basic characteristics of the Fork/Join framework
  • monitor
    • about / Synchronization
  • multiple documents per task, second concurrent version
    • MultipleIndexingTask class / The MultipleIndexingTask class
    • MultipleInvertedIndexTask class / The MultipleInvertedIndexTask class
    • MultipleConcurrentIndexing class / The MultipleConcurrentIndexing class
  • MultithreadedTC
    • concurrent applications, testing with / Testing concurrent applications with MultithreadedTC
  • mutual exclusion
    • about / Synchronization

N

  • non-blocking data structure
    • about / The log system
  • non-blocking operations
    • methods, implementing / Other methods of interest
  • numerical summarization application
    • about / The first example – a numerical summarization application
    • concurrent version / The concurrent version
    • serial version / The serial version
    • two versions, comparing / Comparing the two versions
  • numeric summarization algorithm
    • about / A numeric summarization algorithm

O

  • operation
    • used, for serial streams / Comparing the two versions
  • optimization and search problems
    • about / The second example – a genetic algorithm
    • defining / A genetic algorithm

P

  • parallel streams
    • about / Parallel streams
    • Stream interface / Parallel streams
    • Optional interface / Parallel streams
    • Collectors / Parallel streams
    • Lambda expressions / Parallel streams
  • parallel version, client/server model
    • defining / Client/server – parallel version
    • server part / The server part
    • command part / The command part
  • periodic tasks
    • executing / The second example – executing periodic tasks
    • common parts / The common parts
    • basic reader / The basic reader
    • advanced reader / The advanced reader
  • Phaser class
    • about / An introduction to the Phaser class
    • characteristics / An introduction to the Phaser class
    • participants, registering / Registration and deregistration of participants
    • participants, deregistration / Registration and deregistration of participants
    • phase change, synchronizing / Synchronizing phase changes
    • other functionalities / Other functionalities
    • methods, defining / Other functionalities
  • phases
    • defining, for keywords / First example – a keyword extraction algorithm
  • phases, generation
    • Selection / The second example – a genetic algorithm
    • Crossover / The second example – a genetic algorithm
    • Mutation / The second example – a genetic algorithm
  • phases, recommendation system
    • first phase / A recommendation system using the Map and Collect model
    • second phase / A recommendation system using the Map and Collect model
    • third phase / A recommendation system using the Map and Collect model
  • phenotypes
    • about / The second example – a genetic algorithm
  • portability
    • about / Conclusion
  • problems, in concurrent applications
    • about / Possible problems in concurrent applications
    • data race / Data race
    • deadlock / Deadlock
    • livelock / Livelock
    • resource starvation / Resource starvation
    • priority inversion / Priority inversion
  • Producer/Consumer design pattern
    • about / The second example – executing periodic tasks

Q

  • queue
    • about / BlockingQueue

R

  • recommendation system
    • defining / The second example – a recommendation system
    • about / The second example – a recommendation system, A recommendation system using the Map and Collect model
    • common classes / Common classes
    • main class / The recommendation system – the main class
    • ConcurrentLoaderAccumulator class / The ConcurrentLoaderAccumulator class
    • serial version / The serial version
    • two versions, comparing / Comparing the two versions
    • defining, Map and Collect model used / A recommendation system using the Map and Collect model
  • reduced document query
    • about / The second approach – reduced document query
    • limitedMapper() method / The limitedMapper() method
  • RSS feed reader
    • about / The second example – executing periodic tasks

S

  • SAX (Simple API for XML)
    • about / The common parts
  • scalability
    • about / Conclusion
  • scheduled executor
    • about / The advanced reader
  • search algorithm, without indexing
    • defining / A search algorithm without indexing
  • second concurrent version, best-matching algorithm
    • about / A best-matching algorithm – the second concurrent version
  • semaphore
    • about / Synchronization
  • SerialMergeSort class
    • references / The SerialMergeSort class
  • serial version, best-matching algorithm
    • about / A best-matching algorithm – the serial version
    • BestMatchingSerialCalculation class / The BestMatchingSerialCalculation class
    • BestMachingSerialMain class / The BestMachingSerialMain class
  • serial version, client/server model
    • defining / Client/server – serial version
    • DAO part / The DAO part
    • command part / The command part
    • server part / The server part
  • serial version, data filtering algorithm
    • about / The serial version
    • SerialSearch class / The SerialSearch class
    • SerialMain class / The SerialMain class
  • serial version, genetic algorithm
    • about / The serial version
    • SerialGeneticAlgorithm class / The SerialGeneticAlgorithm class
    • SerialMain class / The SerialMain class
  • serial version, k-means clustering algorithm
    • about / The serial version
    • SerialKMeans class / The SerialKMeans class
    • SerialMain class / The SerialKMeans class
  • serial version, merge sort algorithm
    • about / The serial version
    • SerialMergeSort class / The SerialMergeSort class
    • SerialMetaData class / The SerialMetaData class
  • serial version, social network
    • about / The serial version
    • two versions, comparing / Comparing the two versions
  • serial version, word exists algorithm
    • defining / The word exists algorithm – a serial version
    • ExistSerialCalculation class / The ExistSerialCalculation class
    • ExistSerialMain class / The ExistSerialMain class
  • server application
    • defining / The first example – an advanced server application
    • new characteristics, implementing / The first example – an advanced server application
    • ServerExecutor class / The ServerExecutor class
    • command classes / The command classes
    • server part / The server part
    • client part / The client part
  • ServerExecutor class
    • about / The ServerExecutor class
    • statistics object / The statistics object
    • rejected task controller / The rejected task controller
    • executor tasks / The executor tasks
    • executor / The executor
  • server part
    • about / The server part
    • ConcurrentServer class / The ConcurrentServer class
    • RequestTask classification / The RequestTask class
  • shared memory
    • about / Shared memory versus message passing, The main class of the document clustering application
  • short-circuit operation
    • about / The word exists algorithm – the concurrent version
  • simplicity
    • about / Conclusion
  • Singleton pattern
    • about / Concurrency design patterns
  • SOA (Service-Oriented Architecture)
    • about / The second example – concurrency in a client/server environment
  • social network
    • common contacts / The third example – common contacts in a social network
    • references / The third example – common contacts in a social network
    • base classes / Base classes
    • concurrent version / The concurrent version
    • serial version / The serial version
  • speedup
    • about / Step 5 – tuning
  • states, phaser
    • Active / Other functionalities
    • Termination / Other functionalities
  • stream
    • elements / Using streams to collect data, The ConcurrentStringAccumulator class
  • streams
    • about / An introduction to streams
    • characteristics / Basic characteristics of streams
    • sections, defining / Sections of a stream
    • sources / Sources of a stream
    • intermediate operations / Intermediate operations
    • terminal operations / Terminal operations
    • MapReduce, versus MapCollect / MapReduce versus MapCollect
    • used, for collecting data / Using streams to collect data
  • synchronization
    • about / Synchronization
    • control synchronization / Synchronization
    • data access synchronization / Synchronization
  • synchronization mechanisms
    • synchronized keyword / Synchronization mechanisms
    • Lock interface / Synchronization mechanisms
    • Semaphore class / Synchronization mechanisms
    • CountDownLatch class / Synchronization mechanisms
    • CyclicBarrier class / Synchronization mechanisms
    • Phaser class / Synchronization mechanisms
    • defining / Big-block synchronization mechanisms
    • shared memory / Big-block synchronization mechanisms
    • message passing / Big-block synchronization mechanisms
  • systems, k-means clustering
    • defining / The four systems of k-means clustering
    • Reader system / The Reader system
    • Indexer system / The Indexer system
    • Mapper system / The Mapper system
    • Clustering system / The Clustering system

T

  • task decomposition
    • about / Step 2 – design
  • task per document, first concurrent version
    • IndexingTask class / The IndexingTask class
    • InvertedIndexTask class / The InvertedIndexTask class
    • ConcurrentIndexing class / The ConcurrentIndexing class
  • tasks
    • executing / Introducing the Callable and Future interfaces
  • term frequency
    • about / The second example – creating an inverted index for a collection of documents
  • term frequency-inverse document frequency (tf-idf)
    • about / The first example – the k-means clustering algorithm
  • TF (term frequency)
    • about / First example – a keyword extraction algorithm
  • Tf-Idf (term frequency-inverse document frequency)
    • about / An example of a document clustering application
  • TF-IDF measure
    • about / First example – a keyword extraction algorithm
  • thread-safe
    • about / Synchronization
  • thread safety
    • about / Synchronization
  • tips and tricks, design concurrent algorithms
    • correct independent tasks, identifying / Identify the correct independent tasks
    • concurrency, implementing at higher possible level / Implement concurrency at the highest possible level
    • scalability, taking into account / Take scalability into account
    • thread-safe APIs, using / Use thread-safe APIs
    • execution of tasks / Never assume an execution order
    • local thread variables, preferring over static / Prefer local thread variables over static and shared when possible
    • easier parallelizable version of algorithm, finding / Find the more easily parallelizable version of the algorithm
    • immutable objects, using / Using immutable objects when possible
    • deadlocks, avoiding by ordering locks / Avoiding deadlocks by ordering the locks
    • atomic variables, using instead of synchronization / Using atomic variables instead of synchronization
    • locks, holding / Holding locks for as short a time as possible
    • precautions, taking with lazy initialization / Taking precautions using lazy initialization
    • blocking operations, avoiding in critical section / Avoiding the use of blocking operations inside a critical section
  • Travel Salesman Problem (TSP)
    • about / The second example – a genetic algorithm
    • characteristics / The second example – a genetic algorithm

U

  • UCI Machine Learning Repository
    • about / First example – the k-nearest neighbors algorithm, The first example – a numerical summarization application
  • UK Advanced Cryptics Dictionary (UKACD)
    • about / First example – a best-matching algorithm for words

W

  • word exists algorithm
    • and best-matching algorithms, comparing / Exist algorithms
  • word list
    • URL / First example – a best-matching algorithm for words
  • work-stealing algorithm
    • about / An introduction to the Fork/Join framework
  • worker-threads
    • about / Basic characteristics of executors
  • World Bank
    • URL / The second example – concurrency in a client/server environment
  • World Development Indicators
    • about / The second example – concurrency in a client/server environment