# Parallel computing **[Parallel computing](https://en.wikipedia.org/wiki/Parallel_computing)** is a computational model where work is broken into parts that execute simultaneously across multiple processors, cores, or machines. Modern CPUs gain performance through additional cores rather than clock speed increases, so exploiting parallelism is essential for performance. [[amdahls-law|Amdahl's law]] shows the sequential fraction limits speedup; [[gustafsons-law|Gustafson's law]] shows that scaling problem size with hardware yields near-linear speedup. ## Example This example shows a simple parallel computation using OpenMP. ```c // compile: gcc -fopenmp -o parallel parallel.c // run: ./parallel // description: parallel loop computing array sum #include #include int main() { int arr[100]; for (int i = 0; i < 100; i++) arr[i] = i; int sum = 0; #pragma omp parallel for reduction(+:sum) for (int i = 0; i < 100; i++) { sum += arr[i]; } printf("Sum: %d\n", sum); return 0; } ```