The shared array pattern

Modern operating systems can handle many concurrent processes and fully utilize all processor cores. When it comes to distributed computing, a larger task is typically broken down into smaller ones such that multiple processes can execute the tasks concurrently. Sometimes, the results of these individual executions may need to be combined or aggregated for final delivery. This process is called reduction

This concept is reincarnated in various forms. For example, in functional programming, it is common to implement data processes using map-reduce. The mapping process takes a list and applies a function to each element, and the reduction process combines the results. In big data processing, Hadoop uses a similar form of map-reduce, except that it runs across multiple machines in a cluster. The DataFrames package contains functions that perform the Split-Apply-Combine pattern. These all present pretty much the same concept.

Sometimes, parallel worker processes need to communicate with each other. In general, processes can talk to each other by passing data via some form of Inter-Process Communication (IPC). There are many ways to do that—sockets, Unix domain sockets, pipes, named pipes, message queues, shared memory, and memory maps.

Julia ships with a standard library called SharedArrays, which interfaces with the operating system's shared memory and memory map interface. This facility allows Julia processes to communicate with each other by sharing a central data source.

In this section, we will take a look at how SharedArrays can be used for high-performance computing.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.106.100