![]() ![]() This section covers the following topics: While aggregate operations enable you to more easily implement parallelism, it is still your responsibility to determine if your application is suitable for parallelism. Note that parallelism is not automatically faster than performing operations serially, although it can be if you have enough data and processor cores. Aggregate operations and parallel streams enable you to implement parallelism with non-thread-safe collections provided that you do not modify the collection while you are operating on it. You want to avoid thread contention because it prevents threads from running in parallel. Synchronization wrappers, which add automatic synchronization to an arbitrary collection, making it thread-safe. One difficulty in implementing parallelism in applications that use collections is that collections are not thread-safe, which means that multiple threads cannot manipulate a collection without introducing With aggregate operations, the Java runtime performs this partitioning and combining of solutions for you. However, with this framework, you must specify how the problems are subdivided (partitioned). Java SE provides theįork/join framework, which enables you to more easily implement parallel computing in your applications. ![]() Parallel computing involves dividing a problem into subproblems, solving those problems simultaneously (in parallel, with each subproblem running in a separate thread), and then combining the results of the solutions to the subproblems.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |