Computers of current era are shipped with 4,8 or 16 processor cores. However writing multi-threaded code to leverage full power of multi-processor systems has always been a challenging task. Java does provide APIs for writing multi-threaded code, but developer has to deal with low-level concurrency primitives like threads, locks or synchronized blocks which makes the task very difficult and error prone.
GPars is an open-source concurrency and parallelism library for Java and Groovy that gives number of high-level abstractions for writing concurrent and parallel code. In this session I am going to discuss concepts like map/reduce, fork/join, asynchronous closures, actors, agents ,dataflow and others which makes Java/Groovy code concurrent and/or parallel with little effort.
Broadly the concepts can be divided into following 3 categories
- Code-level helpers : Constructs that can be applied to small parts of the code-base such as individual algorithms or data structures
- Parallel Collections
- Asynchronous Processing
- Fork/Join (Divide/Conquer)
- Data Parallelism