java-design-patterns/master-worker-pattern
Anurag Agarwal 1fdc650545 Resolves checkstyle errors for remaining m (#1090)
* Reduces checkstyle errors in marker

* Reduces checkstyle errors in master-worker-pattern

* Reduces checkstyle errors in mediator

* Reduces checkstyle errors in memento

* Reduces checkstyle errors in model-view-controller

* Reduces checkstyle errors in model-view-presenter

* Reduces checkstyle errors in module

* Reduces checkstyle errors in monad

* Reduces checkstyle errors in monostate

* Reduces checkstyle errors in multiton

* Reduces checkstyle errors in mute-idiom

* Reduces checkstyle errors in mutex
2019-11-16 14:48:23 +02:00
..
2019-10-12 20:05:54 +03:00
2019-02-13 23:04:16 +02:00

layout, title, folder, permalink, categories, tags
layout title folder permalink categories tags
pattern Master-Worker master-worker-pattern /patterns/master-worker-pattern/ Centralised Parallel Processing
Java
Difficulty-Intermediate

Also known as

Master-slave or Map-reduce

Intent

Used for centralised parallel processing.

Applicability

This pattern can be used when data can be divided into multiple parts, all of which need to go through the same computation to give a result, which need to be aggregated to get the final result.

Explanation

In this pattern, parallel processing is performed using a system consisting of a master and some number of workers, where a master divides the work among the workers, gets the result back from them and assimilates all the results to give final result. The only communication is between the master and the worker - none of the workers communicate among one another and the user only communicates with the master to get the required job done. The master has to maintain a record of how the divided data has been distributed, how many workers have finished their work and returned a result, and the results themselves to be able to aggregate the data correctly.

Credits