Java Parallel Programming Part 3: Lambdas and Streams

In my last article, I showed you how to use the Java 7’s Fork/Join framework to write a parallel program. If you examine the code carefully, you will notice that it looks quite different from normal serial Java code. Developers having to write code differently for parallel programs imposes a serious barrier to its wide adoption as a framework for writing parallel programs. What developers want is that they can write code that can be executed serially as well as in parallel. Enter lambdas and streams. The Java community has observed the trend (Moore’s Law, hitting the frequency wall ie, power dissipation issues as described in my previous article) and recognised that chip designers have nowhere to go but parallel. Consequently, software has to be written such that it can take advantage of the parallel hardware. And the OpenJDK Project Lambda was  started in Dec 2009 with the aims to support programming in a multicore environment by adding closures and related features to the Java SE platform. The objectives are realised in Java SE 8 as JSR 335: Lambda Expressions for the Java Programming Language. In this article, I am going to show you how to use lambdas and streams to implement a Mandelbrot generation parallel program and compare its performance with the Fork/Join framework we examined last time. Continue reading Java Parallel Programming Part 3: Lambdas and Streams

Java Parallel Programming Part 2: Fork/Join

This is the first of three posts on Java Parallel Programming using a Shared Memory Model after my introductory post on the subject . In this article, I shall show you how to use Java 7’s Fork/Join framework for parallel programming. As you are aware, multi-threading has been available since Java was first introduced in the last millennium. What’s the fuss regarding Fork/Join then? According to Herbert Schildt in his book “Java The Complete Reference Eighth Edition” (ISBN: 978-0-07-160631-8) on page 1077:

...multithreading is used to allow two or more tasks to share the CPU. This type of multithreading is typically supported by an object of type Thread (as described in Chapter 11). Although this type of multithreading will always remain quite useful, it was not optimized for situations in which two or more CPUs are available (multicore computers)...

In contrast to the usual multithreading model, the Fork/Join Framework introduced in Java 7 automatically scales to make use of multiple processors available. In addition, it simplifies the creation and use of multiple threads as you will see in the code segments later on. Continue reading Java Parallel Programming Part 2: Fork/Join

Java Parallel Programming Part 1: Introduction

The first question you have is probably: What is parallel programming and why? Parallel programming or computing is a form of computation in which many calculations are carried out simultaneously, operating on the principle that large problems can often be divided into smaller ones, which are then solved at the same time. In short, its main aims are to:

  • Increase speed
  • Process huge amount of data
  • Solve problems in real time
  • Solve problems in due time

Why now? Continue reading Java Parallel Programming Part 1: Introduction

Home Compute Cluster Revamp – Part 1


High Performance Computing or HPC refers to the practice of aggregating computing power in a way that delivers much higher performance than one could get out of a single machine in order to solve large problems in science, engineering, or business. In the past, it was quite costly to build a HPC cluster. But with the ever diminishing cost of hardware, I built one some months ago for experimentation. It is now due for a revamp. But before I describe the revamp details, here is a recap on the existing HPC cluster which I shall refer to as my home Compute Cluster. Continue reading Home Compute Cluster Revamp – Part 1