In
computer science
Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
, a parallel algorithm, as opposed to a traditional
serial algorithm, is an
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
which can do multiple operations in a given time. It has been a tradition of
computer science
Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
to describe serial algorithms in
abstract machine models, often the one known as
random-access machine
In computer science, random-access machine (RAM or RA-machine) is a model of computation that describes an abstract machine in the general class of register machines. The RA-machine is very similar to the counter machine but with the added capab ...
. Similarly, many computer science researchers have used a so-called
parallel random-access machine (PRAM) as a parallel abstract machine (shared-memory).
Many parallel algorithms are executed
concurrently – though in general
concurrent algorithms are a distinct concept – and thus these concepts are often conflated, with which aspect of an algorithm is parallel and which is concurrent not being clearly distinguished. Further, non-parallel, non-concurrent algorithms are often referred to as "
sequential algorithms", by contrast with concurrent algorithms.
Parallelizability
Algorithms vary significantly in how parallelizable they are, ranging from easily parallelizable to completely unparallelizable. Further, a given problem may accommodate different algorithms, which may be more or less parallelizable.
Some problems are easy to divide up into pieces in this way – these are called ''
embarrassingly parallel problems.'' Examples include many algorithms to solve
Rubik's Cubes and find values which result in a given
hash.
Some problems cannot be split up into parallel portions, as they require the results from a preceding step to effectively carry on with the next step – these are called s. Examples include iterative
numerical methods
Numerical analysis is the study of algorithms that use numerical approximation (as opposed to symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics). It is the study of numerical methods t ...
, such as
Newton's method
In numerical analysis, the Newton–Raphson method, also known simply as Newton's method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a ...
, iterative solutions to the
three-body problem
In physics, specifically classical mechanics, the three-body problem is to take the initial positions and velocities (or momenta) of three point masses orbiting each other in space and then calculate their subsequent trajectories using Newton' ...
, and most of the available algorithms to compute
pi (π). Some sequential algorithms can be converted into parallel algorithms using
automatic parallelization.
In many cases developing an effective parallel algorithm for solution of some task requires attraction of new ideas and methods comparing to creating a sequential algorithm version. These are, for instance, practically important problems of searching a target element in data structures, evaluation of an algebraic expression, etc.
Motivation
Parallel algorithms on individual devices have become more common since the early 2000s because of substantial improvements in
multiprocessing
Multiprocessing (MP) is the use of two or more central processing units (CPUs) within a single computer system. The term also refers to the ability of a system to support more than one processor or the ability to allocate tasks between them. The ...
systems and the rise of
multi-core
A multi-core processor (MCP) is a microprocessor on a single integrated circuit (IC) with two or more separate central processing units (CPUs), called ''cores'' to emphasize their multiplicity (for example, ''dual-core'' or ''quad-core''). Ea ...
processors. Up until the end of 2004, single-core processor performance rapidly increased via
frequency scaling
In computer architecture, frequency scaling (also known as frequency ramping) is the technique of increasing a processor's frequency so as to enhance the performance of the system containing the processor in question. Frequency ramping was the dom ...
, and thus it was easier to construct a computer with a single fast core than one with many slower cores with the same
throughput
Network throughput (or just throughput, when in context) refers to the rate of message delivery over a communication channel in a communication network, such as Ethernet or packet radio. The data that these messages contain may be delivered ov ...
, so multicore systems were of more limited use. Since 2004 however, frequency scaling hit a wall, and thus multicore systems have become more widespread, making parallel algorithms of more general use.
Issues
Communication
The cost or complexity of serial algorithms is estimated in terms of the space (memory) and time (processor cycles) that they take. Parallel algorithms need to optimize one more resource, the communication between different processors. There are two ways parallel processors communicate, shared memory or message passing.
Shared memory processing needs additional
locking for the data, imposes the overhead of additional processor and bus cycles, and also serializes some portion of the algorithm.
Message passing
In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its supporting ...
processing uses channels and message boxes but this communication adds transfer overhead on the bus, additional memory need for queues and message boxes and latency in the messages. Designs of parallel processors use special
buses like
crossbar so that the communication overhead will be small but it is the parallel algorithm that decides the volume of the traffic.
If the communication overhead of additional processors outweighs the benefit of adding another processor, one encounters
parallel slowdown.
Load balancing
Another problem with parallel algorithms is ensuring that they are suitably
load balanced, by ensuring that ''load'' (overall work) is balanced, rather than input size being balanced. For example, checking all numbers from one to a hundred thousand for primality is easy to split among processors; however, if the numbers are simply divided out evenly (1–1,000, 1,001–2,000, etc.), the amount of work will be unbalanced, as smaller numbers are easier to process by this algorithm (easier to test for primality), and thus some processors will get more work to do than the others, which will sit idle until the loaded processors complete.
Distributed algorithms
A subtype of parallel algorithms, ''
distributed algorithm A distributed algorithm is an algorithm designed to run on computer hardware constructed from interconnected processors. Distributed algorithms are used in different application areas of distributed computing, such as telecommunications, scientifi ...
s'', are algorithms designed to work in
cluster computing
A computer cluster is a set of computers that work together so that they can be viewed as a single system. Unlike Grid computing, grid computers, computer clusters have each Node (networking), node set to perform the same task, controlled an ...
and
distributed computing
Distributed computing is a field of computer science that studies distributed systems, defined as computer systems whose inter-communicating components are located on different networked computers.
The components of a distributed system commu ...
environments, where additional concerns beyond the scope of "classical" parallel algorithms need to be addressed.
See also
*
Multiple-agent system
A multi-agent system (MAS or "self-organized system") is a computerized system composed of multiple interacting intelligent agents.H. Pan; M. Zahmatkesh; F. Rekabi-Bana; F. Arvin; J. HuT-STAR: Time-Optimal Swarm Trajectory Planning for Quadroto ...
(MAS)
*
Parallel algorithms for matrix multiplication
*
Parallel algorithms for minimum spanning trees
*
Parallel computing
Parallel computing is a type of computing, computation in which many calculations or Process (computing), processes are carried out simultaneously. Large problems can often be divided into smaller ones, which can then be solved at the same time. ...
*
Parareal
References
External links
Designing and Building Parallel Programs US Argonne National Laboratory
{{Authority control
Parallel computing
Concurrent algorithms
Distributed algorithms