GPars Logo

Let’s Do It in Parallel

Groovy Parallel Programming for Java Developers

Jon Kerridge

School of Computing Edinburgh Napier University, Scotland

Tel. +44 (0)131 455 2777

Room D30, Merchiston Campus

10 Colinton Road

Edinburgh, Scotland EH10 5DT

17 Nov.2015

Hi Team,

The following documents you refer to have now been superseded by a published text book, which comes in two parts.

The text is available free from

The quickest way is to search for 'bookboon kerridge', which is the way I find my books. In total the books have now been downloaded about 250,000 times up till June 2015.

Concurrency The actual links are:

there is a link on the pulisher’s web site to the code and underlying libraries

So the easiest thing would be to provide a link to these two books so that people can follow them!

I am in the process of writing a follow on book looking at JCSP based parallel patterns but it very much in the development stage at the moment!!

Hope this helps and saves you a lot of effort!!


Professor Jon Kerridge

School of Computing, Edinburgh Napier University, Merchiston Campus

Edinburgh, EH10 5DT

Tel. (0044) 0131 455 2777

Jon Kerridge

  • Faculty of Engineering, Computing & Creative Industries

  • Job Title: Professor

  • School: School of Computing

  • Subject Group: Software Engineering

  • Edinburgh Napier University, Scotland



The aim of this book is to show both students and practitioners that concurrent and parallel programming does not need to be as hard as it is often portrayed and in fact is often easier that building the equivalent sequential system. This will be achieved by presenting a set of example systems that demonstrate the underlying principles of parallel system design based upon real world examples. Each chapter will discuss the complete implementation of such a system, rather than presenting fragments of solutions. The approach will therefore be founded in principled engineering rather than a detailed exploration of the scientific underpinning. The science has been explored in many books but these have not demonstrated the engineering aspects of actually designing and building parallel systems.

For the purposes of this book; Concurrent means a system built from a set of processes that execute on a single processor. Parallel means that more than one processor is used to execute the processes and these communicate over some form of network. Within a parallel system, it is likely that some of the processors will run some processes concurrently.

The book will use, as its underpinning parallel environment, a package called JCSP (Communicating Sequential Processes for Java) that is available under the LGPL software licence from the University of Kent, Canterbury UK. This package implements the Communicating Sequential Process concepts developed by Professor Hoare some 25 years ago in a form that makes them easily accessible to the programmer. The book’s emphasis is on the engineering of parallel systems using these well-defined concepts without delving into their detailed theoretical aspects. The JCSP package essentially hides Java’s underlying thread model from the programmer in a manner that allows easy implementation of concurrent and parallel systems. It is immaterial whether a process is executed concurrently or in parallel, the process definition remains the same.

Understanding the principles behind parallel processing is an increasingly important skill with the advent of multi-core processors. Much effort has been made by processor manufacturers to hide the underlying parallel design techniques by providing tools that will take existing code and extract some parallelism from it. This hides the real need to actually design and build parallel systems from the outset. Far too many people have been put off parallel processing because they believe that they have to understand the underlying thread model supplied as part of the language or operating system environment. The goal of the book is to dispel all these misconceptions and show that parallel system can be built quite easily with a very few simple design patterns and that such parallel systems can be easily implemented on a single processor or a collection of networked processors. Furthermore, the advent of multi- core processors means that we can now start to build genuinely parallel systems for the commonest desktop workstations in which we can exploit the inherent parallelism more easily once we have the tools required to place a process on a specific core. The extension to a network of multi-core processors becomes even easier. Equally important is that the same design principles can be used to build mobile systems that permit interactions between mobile devices and fixed services using wireless and Bluetooth technology.


The book results from a module taught during the spring semester to master’s students, though the approach would be applicable to senior undergraduates and professional programmers. As part of the module, students were asked to complete a practical portfolio and are included in the book. The source coding for all the examples and for solutions to the practical problems is also available. A set of PowerPoint slides is also available for instructors.

Please see org.jcsp.lang in GitHub to test code samples.

Book Index

Why Java ?

Basic Concepts

Process Networks: Build It Like Lego

Parallel Processes: Non Deterministic Input

Extending the Alternative: A Scaling Device and Queues

Testing Parallel Systems: First Steps

Deadlock: An Introduction

Client-Server: Deadlock Avoidance by Design

External Events: Handling Data Multiple Sources

Deadlock Revisited: Circular Structures

Graphical User Interfaces: Brownian Motion

Dining Philosophers: A Classic Problem

Accessing Shared Resources: CREW

Barriers and Buckets: Hand-Eye Co-ordination Test

Communication over Networks: Process Parallelism

Anonymous Network Channels: A Print Server

More Testing: Non-terminating Process Networks

Mobile Agents: Going for a Trip

Mobile Processes: Ubiquitous Wireless Access

Redirecting Channels: A Self Monitoring Process Ring

Mobile Agents and Processes: Process Discovery

Concluding Remarks: Why Use GroovyParallel and JCSP


Works of Professor Jon Kerridge are distributed under the open-source Apache 2 License.

By using this document, you fully accept the terms stated in the license. For full details, please see the Apache 2 License document.