# Parallel in addition to Distributed Algorithms Eric Vidal Reference: R. Johnsonbaugh in addition to M.

## Parallel in addition to Distributed Algorithms Eric Vidal Reference: R. Johnsonbaugh in addition to M.

Greystone, Matt, Contributing Writer has reference to this Academic Journal, PHwiki organized this Journal Parallel in addition to Distributed Algorithms Eric Vidal Reference: R. Johnsonbaugh in addition to M. Schaefer, Algorithms (International Edition). 2004. Pearson Education. Outline Introduction (case study: maximum element) Work-optimality The Parallel R in addition to om Access Machine Shared memory modes Accelerated cascading Other Parallel Architectures (case study: sorting) Circuits Linear processor networks (Mesh processor networks) Distributed Algorithms Message-optimality Broadcast in addition to echo (Leader election) Introduction

This Particular University is Related to this Particular Journal

Why use parallelism p steps on 1 printer, 1 step on p printers p = speed-up factor (best case) Given a sequential algorithm, how can we parallelize it Some are inherently sequential (P-complete) Case Study: Maximum Element In: a[] Out: maximum element in a sequential-maximum(a) { n = a.length max = a[0] as long as i = 1 to n  1 { if (a[i] > max) max = a[i] } return max } 21 11 23 17 48 33 22 41 21 23 23 48 48 48 48 O(n) Parallel Maximum Idea: Use n / 2 processors Note idle processors after the first step! 21 11 23 17 48 33 22 41 21 23 48 41 23 48 48 O(lg n)

Work-Optimality Work = number of algorithmic steps × number of processors Running time of parallelized maximum algo = O(lg n) × (n / 2) = O(n lg n) Not work-optimal! Sequential algos work is O(n) Workaround: accelerated cascading Formal Algorithm as long as Parallel Maximum But first! The Parallel R in addition to om Access Machine

More Intelligent Processors: Processor Networks Star Linear/Ring Completely-connected Mesh Diameter = 2 Diameter = n  1 (or n  2) Diameter = 1 Sorting on Linear Networks Emulate an odd-even transposition network! O(n) steps, work is O(n2) We cant expect better on a linear network 18 42 31 56 12 11 19 18 42 31 56 11 12 19 18 31 42 11 56 12 19 18 31 11 42 12 56 19 18 11 31 12 42 19 56 11 18 12 31 19 42 56 11 12 18 19 31 42 56 11 12 18 19 31 42 56 Sorting on Mesh Networks: Shearsort Arrange numbers in boustrophedon order a = { 15, 4, 10, 6, 1, 5, 7, 11, 12, 14, 13, 8, 9, 16, 2, 3 } Row phase Sort rows, sort columns, repeat

Sorting on Mesh Networks: Shearsort Arrange numbers in boustrophedon order a = { 15, 4, 10, 6, 1, 5, 7, 11, 12, 14, 13, 8, 9, 16, 2, 3 } Column phase Sort rows, sort columns, repeat Sorting on Mesh Networks: Shearsort Arrange numbers in boustrophedon order a = { 15, 4, 10, 6, 1, 5, 7, 11, 12, 14, 13, 8, 9, 16, 2, 3 } Row phase Sort rows, sort columns, repeat Sorting on Mesh Networks: Shearsort Arrange numbers in boustrophedon order a = { 15, 4, 10, 6, 1, 5, 7, 11, 12, 14, 13, 8, 9, 16, 2, 3 } Column phase Sort rows, sort columns, repeat