ArticleslgStudy

computer science

Parallel external memory

Parallel external memory is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Parallel external memory rather than just read about it. In short: In computer science, a parallel external memory (PEM) model is a cache-aware, external-memory abstract machine. It is the parallel-computing analogy to the single-processor external memory (EM) model.

Parallel external memory — main illustration
Parallel external memory — illustration

Key takeaways

  • Parallel external memory belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Parallel external memory to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Parallel external memory from memory before moving on to harder problems.

Reference excerpt

In computer science, a parallel external memory (PEM) model is a cache-aware, external-memory abstract machine. It is the parallel-computing analogy to the single-processor external memory (EM) model. In a similar way, it is the cache-aware analogy to the parallel random-access machine (PRAM). The PEM model consists of a number of processors, together with their respective private caches and a shared main memory.

Model

Definition The PEM model is a combination of the EM model and the PRAM model. The PEM model is a computation model which consists of P processors and a two-level memory hierarchy. This memory hierarchy consists of a large external memory (main memory) of size N and P small internal memories (caches). The processors share the main memory. Each cache is exclusive to a single processor. A processor can't access another’s cache. The caches have a size M which is partitioned in blocks of size B. The processors can only perform operations on data which are in their cache. The data can be transferred between the main memory and the cache in blocks of size B.

I/O complexity The complexity measure of the PEM model is the I/O complexity, which determines the number of parallel blocks transfers between the main memory and the cache. During a parallel block transfer each processor can transfer a block. So if P processors load parallelly a data block of size B form the main memory into their caches, it is considered as an I/O complexity of O(1) not O(P). A program in the PEM model should minimize the data transfer between main memory and caches and operate as much as possible on the data in the caches.

Read/write conflicts In the PEM model, there is no direct communication network between the P processors. The processors have to communicate indirectly over the main memory. If multiple processors try to access the same block in main memory concurrently read/write conflicts occur. Like in the PRAM model, three different variations of this problem are considered:

Concurrent Read Concurrent Write (CRCW): The same block in main memory can be read and written by multiple processors concurrently. Concurrent Read Exclusive Write (CREW): The same block in main memory can be read by multiple processors concurrently. Only one processor can write to a block at a time. Exclusive Read Exclusive Write (EREW): The same block in main memory cannot be read or written by multiple processors concurrently. Only one processor can access a block at a time. The following two algorithms solve the CREW and EREW problem if P≤B processors write to the same block simultaneously. A first approach is to serialize the write operations. Only one processor after the other writes to the block. This results in a total of P parallel block transfers. A second approach needs O(log⁡(P)) parallel block transfers and an additional block for each processor. The main idea is to schedule the write operations in a binary tree fashion and gradually combine the data into a single block. In the first round P processors combine their blocks into P/2 blocks. Then P/2 processors combine the P/2 blocks into P/4. This procedure is continued until all the data is combined in one block.

Comparison to other models

Examples

Multiway partitioning Let M={m1,...,md−1} be a vector of d-1 pivots sorted in increasing order. Let A be an unordered set of N elements. A d-way partition of A is a set Π={A1,...,Ad} , where ∪i=1dAi=A and Ai∩Aj=∅︀ for 1≤i<j≤d. Ai is called the i-th bucket. The number of elements in Ai is greater than mi−1 and smaller than mi2. In the following algorithm the input is partitioned into N/P-sized contiguous segments S1,...,SP in main memory. The processor i primarily works on the segment Si. The multiway partitioning algorithm (PEM_DIST_SORT) uses a PEM prefix sum algorithm to calculate the prefix sum with the optimal O(NPB+log⁡P) I/O complexity. This algorithm simulates an optimal PRAM prefix sum algorithm.

// Compute parallelly a d-way partition on the data segments Si for each processor i in parallel do Read the vector of pivots M into the cache. Partition Si into d buckets and let vector Mi={j1i,...,jdi} be the number of items in each bucket. end for

Run PEM prefix sum on the set of vectors {M1,...,MP} simultaneously.

// Use the prefix sum vector to compute the final partition for each processor i in parallel do Write elements Si into memory locations offset appropriately by Mi−1 and Mi. end for

Using the prefix sums stored in MP the last processor P calculates the vector B of bucket sizes and returns it.

If the vector of d=O(MB) pivots M and the input set A are located in contiguous memory, then the d-way partitioning problem can be solved in the PEM model with O(NPB+⌈dB⌉>log⁡(P)+dlog⁡(B)) I/O complexity. The content of the final buckets have to be located in contiguous memory.

Selection The selection problem is about finding the k-th smallest item in an unordered list A of size N. The following code makes use of PRAMSORT which is a PRAM optimal sorting algorithm which runs in O(log⁡N), and SELECT, which is a cache optimal single-processor selection algorithm.

if N≤P then 𝙿𝚁𝙰𝙼𝚂𝙾𝚁𝚃(A,P) return A[k] end if

//Find median of each Si for each processor i in parallel do mi=𝚂𝙴𝙻𝙴𝙲𝚃(Si,N2P) end for

// Sort medians 𝙿𝚁𝙰𝙼𝚂𝙾𝚁𝚃({m1,…,m2},P)

// Partition around median of medians t=𝙿𝙴𝙼𝙿𝙰𝚁𝚃𝙸𝚃𝙸𝙾𝙽(A,mP/2,P)

if k≤t then return 𝙿𝙴𝙼𝚂𝙴𝙻𝙴𝙲𝚃(A[1:t],P,k) else return 𝙿𝙴𝙼𝚂𝙴𝙻𝙴𝙲𝚃(A[t+1:N],P,k−t) end if

Under the assumption that the input is stored in contiguous memory, PEMSELECT has an I/O complexity of:

O(NPB+log⁡(PB)⋅log⁡(NP))

Distribution sort Distribution sort partitions an input list A of size N into d disjoint buckets of similar size. Every bucket is then sorted recursively and the results are combined into a fully sorted list. If P=1 the task is delegated to a cache-optimal single-processor sorting algorithm. Otherwise the following algorithm is used:

// Sample 4Nd elements from A for each processor i in parallel do if M<|Si| then d=M/B Load Si in M-sized pages and sort pages individually else d=|Si| Load and sort Si as single page end if Pick every d/4'th element from each sorted memory page into contiguous vector Ri of samples end for

in parallel do Combine vectors R1…RP into a single contiguous vector ℛ Make d copies of ℛ: ℛ1…ℛd end do

… excerpt ends here. Continue reading the full article.

Illustrations

Parallel external memory: PEM Model
PEM Model

Worked examples

Example 1 — a first encounter with Parallel external memory

Start with the simplest possible case. Write down what Parallel external memory claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Parallel external memory before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Parallel external memory ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Parallel external memory

In research
Parallel external memory appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Parallel external memory in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Parallel external memory is common in secondary-school and first-year university syllabi. It links to neighbouring topics Algorithms, Analysis of parallel algorithms, Cache (computing), so understanding it makes those chapters shorter.
In everyday life
Look for Parallel external memory outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Parallel external memory” →

How to study Parallel external memory in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Parallel external memory means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Parallel external memory out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Parallel external memory in simple terms?

In computer science, a parallel external memory (PEM) model is a cache-aware, external-memory abstract machine. It is the parallel-computing analogy to the single-processor external memory (EM) model.

Why does Parallel external memory matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Parallel external memory?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Parallel external memory.

Tags

  • Algorithms
  • Analysis of parallel algorithms
  • Cache (computing)
  • External memory algorithms
  • Models of computation

Keep exploring