GPars: Solution For Common Concurrency Problems

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

  1. 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)
  2. Architecture-level concepts : Constructs that need to be taken into account when designing the project structure
    • Actors
    • Dataflow
    • Data Parallelism
  3. Shared Mutable State Protection
    • Agents


Gagan Agarwal is a Sr. Consultant at Xebia IT Architects. He has 7 years of experience in Software industry and has worked mainly on Java/J2EE and related technologies. Cont…

IndicThreads Conference On Software Development will be held on 13-14 July 2012 in Delhi India. Click for details on Sessions, Speakers and Location. *Register now to grab the current discounted rates!

Comments are closed.