DS C9 Parallelism
Overview
Machine parallelism
- Processor parallelism
- Pipelining
- Very-Long Instruction Word (VLIW)
Parallel algorithms
Parallel Random Access Machine (PRAM)
A Parallel Random Access Machine (PRAM) is a theoretical model of computation that is used to design parallel algorithms.
- It is a shared-memory model
- It allows multiple processors to access the same memory location simultaneously.
We define that a read/write/computation a unit time access.
1 | |
Access conflicts solution
| solution | Read | Write |
|---|---|---|
| EREW | Exclusive | Exclusive |
| CREW | Concurrent | Exclusive |
| CRCW | Concurrent | Concurrent |
There may be rules for CRCW to ensure compatibility:
- Arbitrary rule: allow write access of a random write-intensive processor
- Priority rule: allow write access for the write-intensive processor with highest priority
- Common rule: allow write access if all the processors are trying to write the same value.
Exp: The summation problem
Partitioning
- partitioning - partition the input into a large number, say p, of independent small jobs, so that the size of the largest small job is roughly .
- actual work - do these small jobs concurrently using a separate (possibly serial) algorithm for each.
Exp: Merge sorted arrays
Merge sorted arrays problem merges two non-decreasing arrays and into another non-decreasing array .
Assume that
- the elements of A and B are pairwise distinct
- both and are integers
Transform the problem into a Ranking problem. We’ll know the position to set if we know
- the number of the elements that less than in array , denoted as
- the number of the elements that less than in array , which is
Then indexing from , .
Similarly, .
DS C9 Parallelism
http://example.com/2023/06/06/DS-09/