/mandelbrot

A multicore implementation of the mandelbrot fractal, using Java Fork/Join

Primary LanguageJavaMIT LicenseMIT

Parallel Mandelbrot fractal generation using Fork/Join

Renders the famous Mandelbrot fractal in parallel using multiple CPU cores, using the java.util.concurrent Fork/Join framework.

This code was originally written as part of my university course on Multicore Programming to show students a textbook example of an "embarrasingly parallel" computation that can be nicely sped up using the Fork/Join abstraction.

To compile:

javac Mandelbrot.java

To render sequentially:

java Mandelbrot

To render in parallel:

java Mandelbrot -p

To show a grid of pixel areas allocated to each leaf task (showing what pixels can get calculated in parallel):

java Mandelbrot -p -g

Rendered output:

Rendered result

On my 8-core MBP, renders in approximately 35 milliseconds sequentially and approximately 20 milliseconds in parallel (using vanilla ForkJoinPool settings).