Unit V · Sessions 13–15

Applications of Parallel Computing

Complete revision notes. Everything in this unit, organised by topic — definitions, diagrams, formulas, comparison tables and worked examples. Revise from this alone and you have the whole unit.

Contents

Quick recall — every table and formula in one place · Self-check questions

Part A — Scientific Computing & Parallel Databases

A1. Domain decomposition

Scientific simulation — weather, fluid dynamics, structural analysis — divides physical space into a grid of cells and repeatedly updates each cell from its neighbours' values. Domain decomposition splits that grid across processors: each owns a block of space and simulates only its own cells. This is PCAM's Partition step (Unit III) made physical.

The atmosphere over a region, split across 4 processors

   +---------+---------+
   |   P0    |   P1    |     Each processor owns a rectangular
   |  (NW)   |  (NE)   |     block of cells and simulates only
   +---------+---------+     those.
   |   P2    |   P3    |
   |  (SW)   |  (SE)   |
   +---------+---------+

The difficulty: to update a cell you need its neighbours' values, but cells on the edge of P0's block have neighbours living on P1, P2 and P3. So the processors must communicate every time step.

A2. Halo cells and the halo tax

Halo cells (or ghost cells) are a one-cell-deep border copy of the neighbouring processors' edge values, held locally. Each time step: exchange edges, then update.

P0's block, with a halo border received from neighbours

   . . . . . . .     ".":  halo cells — copies of neighbours' edges,
   . # # # # # .           refreshed every step
   . # # # # # .     "#":  P0's own cells, which P0 updates
   . # # # # # .
   . # # # # # .
   . . . . . . .

   Computation  — local to each block, scales beautifully
   Halo exchange — communication, the enemy

Worked example — the halo tax. A 1000×1000 grid on 100 processors. Every processor computes the same 10,000 cells either way; only the shape of its piece differs.

      1-D STRIPS                          2-D BLOCKS
  each proc: 10 x 1000                each proc: 100 x 100
  +--------------------------+        +------+------+------+
  |========= proc 0 =========|        | p0   | p1   | p2   |
  |========= proc 1 =========|        +------+------+------+
  |========= proc 2 =========|        | p3   | p4   | p5   |
  |           ...            |        +------+------+------+
  halo = 2 edges x 1000 cells         halo = 4 edges x 100 cells
       = 2,000 cells exchanged             = 400 cells exchanged
LayoutCells computedCells communicatedCommunication overhead
1-D strips10,0002,00020%
2-D blocks10,0004004% — five times less

The principle is fat blocks, thin seams: a compact block maximises interior work per unit of border. Because computation scales with area and communication with perimeter, the surface-to-volume ratio improves as blocks get larger — which is exactly PCAM's Agglomeration step, and the reason communication overhead worsens as you spread a fixed problem over more processors.

A3. Monte Carlo methods

Some science needs no neighbours at all. Monte Carlo methods answer questions by averaging a large number of independent random samples — making them the archetype of an embarrassingly parallel workload (Unit III).

ESTIMATING pi BY THROWING DARTS

   +-------------------+     Square area  = (2r)^2 = 4r^2
   |    . . * . . *    |     Circle area  = pi * r^2
   |   . ( * * * ) .   |
   |  .  (* * * *) .*  |     inside / total  ->  pi*r^2 / 4r^2  =  pi/4
   |   . ( * * * ) .   |
   |    . * . . * .    |     so    pi  ~=  4 x inside / total
   +-------------------+

Every dart is independent. Split 10M darts across 8 cores, each throws
1.25M, then sum the inside-counts — ONE reduction at the end.
Near-perfect linear speedup.

One practical caution: each thread or rank must use an independent random-number stream. Sharing one generator either serialises the computation or produces correlated samples that silently corrupt the result.

A4. Parallel database architectures

A table with two billion rows will not scan — or even fit — on one machine. You can scale up (a bigger box, which has a ceiling) or scale out (more boxes, no ceiling). Parallel databases scale out.

ArchitectureWhat is sharedScales?
Shared-memoryOne box; all cores share RAM and diskOnly to one machine's limit
Shared-diskSeparate CPUs, one shared storage systemStorage becomes the bottleneck
Shared-nothingNothing — each node owns its own CPU, RAM and diskYes — add nodes

Shared-nothing is the architecture behind every large modern database. Nodes communicate only over the network, so there is no shared resource to contend on — it is precisely the distributed-memory model of Unit I, which makes MPI and parallel databases close cousins.

A5. Sharding and the shard key

Sharding (horizontal partitioning) splits a table's rows across nodes. You choose a shard key and a rule for mapping key values to shards.

users table sharded by hash(user_id) % 3

   Shard 0          Shard 1          Shard 2
   +----------+     +----------+     +----------+
   | u3  u6   |     | u1  u4   |     | u2  u5   |
   | u9  u12  |     | u7  u10  |     | u8  u11  |
   +----------+     +----------+     +----------+
   Node A           Node B           Node C
SchemeHowGood forBad for
Hash shardinghash(key) mod NEven spread, no hot spots; key lookupsRange scans — adjacent keys land on different nodes
Range shardingA–F on node 0, G–M on node 1, …Range queriesHot shards if the distribution is skewed

The classic failure. Shard by region and 80% of rows land in one region — one shard does all the work while the rest idle. That is load imbalance (Unit III) wearing a database costume, and it is the single most consequential schema decision in a distributed database. Choose a key that spreads evenly.

A6. Parallel query execution

SELECT COUNT(*) FROM events WHERE country = 'IN'

                    Coordinator
                   /     |      \       (1) fan-out to all shards
              Shard0   Shard1   Shard2
               scan     scan     scan   (2) each scans its own slice
               =12M     =15M     =11M       in parallel
                   \     |      /
                    Coordinator           (3) merge the partials
                        = 38M                 12M + 15M + 11M = 38M

This is fan-out / fan-in — the same scatter/gather shape as MPI collectives (Unit IV) and MapReduce (Part B). Aggregates such as COUNT, SUM, MIN and MAX are reductions, and combine trivially.

The classic gotcha: you cannot average the averages. AVG is not directly reducible, because averaging per-shard averages weights each shard equally regardless of its row count. Each shard must return SUM and COUNT, and the coordinator divides at the end. The same applies to any aggregate that is not associative.

A7. Parallel joins — the hard one

A row on shard 0 may need to match a row on shard 2. Three strategies, best to worst:

StrategyHow it worksCostWhen
Co-located joinBoth tables sharded on the join key, so matching rows already sit on the same nodeZero network — the idealYou controlled the schema and chose well
Broadcast joinOne table is small; copy it in full to every nodeSmall table × N nodesOne side is tiny (a dimension table)
Shuffle joinNeither table is co-partitioned, so re-send and re-partition both by the join keyExpensive — the whole dataset crosses the networkLast resort

This is why the shard-key choice matters so much: sharding both tables on the join key turns a shuffle join into a co-located join and can take a report from minutes to seconds without changing a line of query text.

A8. OLTP vs OLAP

OLTPOLAP
Full nameOnline Transaction ProcessingOnline Analytical Processing
WorkloadMillions of tiny reads and writesScan-everything analytical queries
Optimised forLatency per transactionThroughput over huge scans
ExampleThe live application databaseA warehouse: BigQuery, Snowflake, Redshift

A large scan is the perfect parallel workload: split a trillion rows over a thousand machines, scan in parallel, merge. That is Gustafson's Law (Unit III) in production — more data in the same time.

StepScienceDatabase
PartitionSplit the gridShard the table
ComputeUpdate my cellsScan my shard
CommunicateHalo exchangeFan-out / shuffle
CombineAssemble the fieldMerge partials

Same idea, different clothes: partition → compute → communicate as little as possible → combine.

Part B — Big Data & Parallel Processing

B1. Move the code, not the data

Suppose 1,000 GB of logs sit on 100 machines, 10 GB each, and you want to count something across all of it.

ApproachWhat crosses the networkVerdict
Move data to codeAll 1,000 GB, to one big machineThe network is the slowest thing in the building. Dead on arrival.
Move code to dataA 5 KB program, out to 100 machines; only the tiny result comes backThis scales.

Data locality — run the computation where the data already lives. A program is kilobytes; the data is terabytes. Always move the small thing. This is simply data parallelism (Unit I) where the "cores" are now whole machines.

B2. HDFS — split and replicate

The Hadoop Distributed File System chops a huge file into blocks (typically 128 MB) and keeps three copies of each block on different machines.

A 512 MB file in HDFS   (4 blocks, replication factor 3)

           Block 1     Block 2     Block 3     Block 4
 Node A      [B1]                    [B3]
 Node B      [B1]        [B2]                    [B4]
 Node C                  [B2]        [B3]
 Node D      [B1]        [B2]                    [B4]
 Node E                              [B3]        [B4]

 Every block lives on 3 machines. A disk dies -> the data survives.

Replication serves two purposes: fault tolerance and locality — with three copies, the scheduler has three chances to place a task on a machine that already holds the data. In a cluster of thousands of cheap machines something is always broken, so a dead disk must be a non-event: Hadoop reads another copy and quietly creates a fresh third one. At this scale fault tolerance is not a feature, it is survival.

B3. The MapReduce model

INPUT --> MAP (parallel) --> SHUFFLE & SORT --> REDUCE (parallel) --> OUTPUT
           emit (k,v)          group by key       combine per key
StageWhat it doesCharacter
MapEach input record → zero or more (key, value) pairs. Runs in parallel on every chunk.Data parallel
Shuffle & sortThe framework groups all values by key across the clusterThe network-heavy step — usually the whole cost
ReduceOne key plus all its values → combined output. Runs in parallel.The reduction from Units I and IV
Combiner (optional)A mini-reduce run locally on the mapper's output before the shuffleThe optimisation that decides everything

You write only map and reduce; the framework provides parallelism, distribution, scheduling and failure recovery. The restriction is the point: because every job has the same shape, the framework solves the hard distributed-systems problems once, for everyone.

B4. Word count, and why the combiner decides everything

WORD COUNT — the "hello world" of MapReduce

  map(line):        for each word w in line:  emit(w, 1)
  reduce(w, list):  emit(w, sum(list))

  Input:  "the cat the dog"     "the cat sat"
  Map:    (the,1)(cat,1)        (the,1)(cat,1)(sat,1)
          (the,1)(dog,1)
  Shuffle: the -> [1,1,1]   cat -> [1,1]   dog -> [1]   sat -> [1]
  Reduce:  (the,3)          (cat,2)        (dog,1)      (sat,1)

Worked example — the shuffle is the whole cost. Word count over 1 TB of text, roughly 170 billion words, across 1,000 mappers. The map and reduce functions are trivial, so where does the time go?

WITHOUT a combiner:
  map emits ("the",1) once per occurrence
  intermediate pairs: 170,000,000,000
  at ~12 bytes each:  ~2 TB must cross the network in the shuffle

WITH a combiner (aggregate locally before sending):
  each mapper emits ("the", 4,213,905) — ONE pair per distinct word
  ~1,000,000 distinct words x 1,000 mappers x 12 bytes
                      ~12 GB crosses the network
StageNo combinerWith combiner
Read 1 TB from HDFS (local disks, parallel)~100 s~100 s
Map: split into words~60 s~60 s
Shuffle across the network~2,000 s~12 s
Reduce: add up the counts~20 s~5 s
Total~36 minutes~3 minutes

Identical map and reduce functions; a 12× difference from one local aggregation step. Note what a combiner is: accumulate locally, combine once — the same principle as an OpenMP reduction, the fix for false sharing, and the CUDA reduction tree. A combiner is valid only when the reduce operation is associative and commutative (sum, max, count — but not average, for the reason in A6).

B5. Hadoop's flaw: the disk

MapReduce writes to disk between every step.

An iterative job (3 passes over the data):

  DISK -> Map -> Reduce -> DISK -> Map -> Reduce -> DISK -> Map -> Reduce -> DISK
          '--- a full disk round-trip between every stage — the killer ---'

For a single pass this is fine. But most analytics — and all machine learning — loop over the same data twenty or thirty times, which means thirty rounds of writing gigabytes to disk and reading them back. Recall from Unit II that RAM is roughly 100× faster than disk; that number is the whole plot.

B6. Apache Spark

Spark, the same iterative job:

  DISK -> [ load once ]  Map -> Reduce -> Map -> Reduce -> Map -> Reduce -> DISK
                         '------- all in memory, no disk between -------'
DimensionHadoop MapReduceApache Spark
Data between stepsWritten to diskKept in memory
Speed on iterative jobsBaseline10–100× faster
APIJust map + reduce, verboseSQL, DataFrames, Python, MLlib, streaming
EvaluationEager, stage by stageLazy — optimises a DAG first
Fault toleranceReplication + re-run the taskLineage — recompute lost partitions
Best forHuge single-pass batch jobs; low memoryIterative ML, interactive queries

The honest nuance: Hadoop is not dead. HDFS remains a common storage layer and giant single-pass jobs still suit MapReduce. But for iterative and interactive work, Spark won. Twenty years of one idea: Google's MapReduce paper (2004) → Hadoop (2006) → Spark (2014) → cloud data platforms — split the data, map in parallel, shuffle by key, reduce in parallel, getting faster and easier the whole way.

Part C — Real-Time Systems & Recent Trends

C1. When being on time is being correct

A real-time system is one whose correctness depends not only on the result produced, but on when that result arrives.

A self-driving car that computes the correct braking decision 50 ms too late has computed the wrong decision. This is a deliberate reversal of the course's usual framing: Unit I established that parallelism buys throughput rather than latency. Real-time systems are the exception — here, guaranteed and predictable latency is the entire point, and determinism is prized over average speed. A system with a worse average response but a bounded worst case is the better real-time system.

C2. Hard vs soft real-time

TypeA late answer is…Examples
Hard real-timeA system failure — the deadline is absoluteABS brakes, airbags, pacemaker, flight control, robot arm
Firm real-timeUseless, but not catastrophic — the result is discardedA missed frame in a rendering pipeline
Soft real-timeDegraded quality, but tolerableVideo call, game frame rate, live audio, stock ticker

Where parallelism appears in real-time systems:

C3. Schedulability — RMS and EDF

Real-time is the one place in this course where you can prove on paper, before running anything, that a system will be fast enough. For a set of n periodic tasks, task i having period Ti and worst-case execution time Ci, the total processor utilisation is U = Σ Ci/Ti.

TaskPeriod T (runs every…)Execution C (needs…)Utilisation C/T
Read the brake sensor50 ms12 ms0.24
Update the display100 ms20 ms0.20
Log diagnostics200 ms90 ms0.45
Total utilisation U0.89
RATE-MONOTONIC SCHEDULING (RMS)
   Fixed priority: shorter period = higher priority.
   Guaranteed schedulable if   U <= n( 2^(1/n) - 1 )
   for n = 3:                  U <= 3(1.2599 - 1) = 0.779
   we have U = 0.89            -> test FAILS, no guarantee

EARLIEST-DEADLINE-FIRST (EDF)
   Dynamic priority: whichever task's deadline is nearest runs next.
   Guaranteed schedulable if   U <= 1
   we have U = 0.89            -> GUARANTEED to meet every deadline
Rate-Monotonic (RMS)Earliest-Deadline-First (EDF)
PriorityFixed, assigned by periodDynamic, by nearest deadline
BoundU ≤ n(21/n − 1) → 0.693 as n → ∞U ≤ 1 — optimal
AdvantageSimple, predictable, low overhead; easy to implement in an RTOSUses the processor fully
DisadvantageWastes up to ~30% of capacityHigher runtime overhead; behaviour degrades unpredictably on overload

Note carefully that the RMS bound is sufficient but not necessary: failing it does not prove the task set is unschedulable, only that this simple test cannot guarantee it. EDF's bound of U ≤ 1 is both necessary and sufficient, which is why EDF is called optimal for single-processor periodic scheduling.

C4. Federated learning

Federated learning trains a shared machine-learning model across many devices holding local data, without that data ever leaving the device. It is the course's ideas assembled at planetary scale.

ONE FEDERATED ROUND

   +---------------------------------------------+
   |            CENTRAL SERVER (model)           |
   +---------------------------------------------+
        |  (1) send the current model to devices
        v           v           v           v
   +--------+  +--------+  +--------+  +--------+
   |Phone A |  |Phone B |  |Hospital|  |Phone D |
   | local  |  | local  |  | local  |  | local  |   (2) each trains
   | data   |  | data   |  | data   |  | data   |       LOCALLY on its
   +--------+  +--------+  +--------+  +--------+       OWN private data
        |           |           |           |
        +------ (3) send back ONLY the updates -------+
                    (weight changes / gradients —
                     never the raw data)
                            v
   +---------------------------------------------+
   |   SERVER AGGREGATES updates -> new model    |   (4) Federated
   |   (Federated Averaging: a weighted mean)    |       Averaging
   +---------------------------------------------+

Worked example — why you cannot centralise the data. Train a photo model across 1,000,000 phones, each holding about 1,000 photos of 2 MB. The arithmetic settles it before any privacy argument does.

Centralise the dataFederated — send the model instead
What crosses the networkEvery photoA 10 MB model out, ~10 MB of updates back
Devices per roundAll 1,000,000A sample of 1,000
Traffic109 photos × 2 MB = 2 PB, once1,000 × 20 MB = 20 GB per round
Total over 1,000 rounds2 PB (then stored and secured forever)~20 TB
Raw photos leaving the deviceAll of themNone. Ever.
Position under GDPR / DPDPA liability you now ownNo personal data was collected

Two petabytes at 100 Gb/s — about the fastest link you could realistically buy — takes roughly two days of continuous transfer, and that is before you have paid to store and secure it. Federated learning moves about 100× less data and removes the legal liability entirely. It is not primarily a privacy feature; it is the only arithmetic that works.

Why it is hard: devices have wildly unequal data (non-IID), unequal compute, and drop offline mid-round — load imbalance and fault tolerance from Units III and V, at the scale of a billion stragglers. It is nevertheless deployed in production, in mobile keyboard prediction and in cross-hospital medical models.

C5. Edge computing

Edge computing performs computation near where the data is produced — on the phone, in the car, at the 5G tower — rather than in a distant cloud. The benefits are lower latency, better privacy and less bandwidth consumed. It is Part B's "move the computation to the data" principle pushed all the way out to the device.

C6. Distributed AI training — three parallelisms at once

KindWhat is splitUsed when
Data parallelismEach GPU gets a different slice of the training data; every GPU holds a full copy of the modelThe default — the model fits on one GPU
Model parallelismThe model itself is split; different layers live on different GPUsThe model is too large for one GPU's memory
Pipeline parallelismLike a factory line — batch 1 is at layer 3 while batch 2 is at layer 1Combined with model parallelism, to keep every GPU busy

Large model training uses all three simultaneously. Note that these are exactly the data, task and pipeline decompositions of Unit I, reappearing at the largest scale computing currently operates at — and that data-parallel training's gradient-averaging step is an Allreduce (Unit IV).

C7. The one continuous idea

  thread -> core -> GPU -> node -> cluster -> data centre -> the planet
    |        |       |       |         |            |             |
  OpenMP   multi-  CUDA /   MPI      MPI /      MapReduce /   Federated
  thread   core     SIMT   ranks    clusters      Spark        learning

  "Split the work into independent pieces, run them at once,
   keep coordination cheap, and combine the results."

              ... the SAME idea, at a bigger and bigger scale.

The three questions that never change

  1. What can run in parallel? — decomposition (Unit III)
  2. What is the ceiling? — Amdahl, the serial fraction, the critical path (Unit III)
  3. How do I keep coordination cheap? — communication, load balance, coherence (Units II and III)

The tools change every few years. These three questions never do.

Quick recall

Formulas and numbers

Monte Carlo pi      pi ~= 4 x (darts inside circle) / (total darts)
Utilisation         U = sum of C_i / T_i
RMS bound           U <= n( 2^(1/n) - 1 )      n=3 -> 0.779, limit 0.693
EDF bound           U <= 1                     (optimal, uniprocessor)
Halo, 1-D strips    2 edges x 1000 = 2,000 cells  -> 20% overhead
Halo, 2-D blocks    4 edges x 100  =   400 cells  ->  4% overhead
HDFS                block ~128 MB, replication factor 3
Shuffle w/o combiner  ~2 TB, ~36 min   |   with combiner ~12 GB, ~3 min
Spark vs Hadoop     10-100x faster on iterative jobs (RAM ~100x disk)

The definitions you must be able to state

Self-check

Answer each out loud before opening it.

1. What are halo cells, and why do 2-D blocks beat 1-D strips?
Halo (ghost) cells are a one-cell border copy of neighbouring processors' edge values, refreshed every time step so each processor can update its own edge cells. On a 1000×1000 grid over 100 processors, both layouts compute 10,000 cells each, but strips of 10×1000 exchange 2 edges × 1000 = 2,000 cells (20% overhead) while blocks of 100×100 exchange 4 edges × 100 = 400 cells (4%). Computation scales with area and communication with perimeter, so compact blocks win — fat blocks, thin seams.
2. Explain how Monte Carlo estimates π, and why it parallelises perfectly.
Throw random darts at a square of side 2r containing an inscribed circle of radius r. The ratio of areas is πr²/4r² = π/4, so π ≈ 4 × inside/total. Every dart is independent, so 10M darts split across 8 cores need no communication until a single reduction of the inside-counts at the end — near-perfect linear speedup. The one trap: each worker needs an independent random-number stream, or the samples are correlated.
3. Compare shared-memory, shared-disk and shared-nothing database architectures.
Shared-memory: one box, all cores share RAM and disk — limited to one machine. Shared-disk: separate CPUs over one shared storage system — storage becomes the bottleneck. Shared-nothing: each node owns its CPU, RAM and disk and nodes talk only over the network — no contended resource, so it scales by adding nodes. Shared-nothing is the distributed-memory model of Unit I, which is why MPI and parallel databases are cousins.
4. Compare hash and range sharding. What goes wrong if you shard by region?
Hash sharding (hash(key) mod N) spreads rows evenly and suits key lookups, but scatters adjacent keys so range scans must hit every shard. Range sharding keeps adjacent keys together and suits range queries, but risks hot shards under a skewed distribution. Sharding by region typically puts 80% of rows on one shard, so one node does all the work while the rest idle — load imbalance in a database costume.
5. Trace a parallel COUNT query, and explain why you cannot average the averages.
The coordinator fans the query out to every shard; each scans only its own slice in parallel (12M, 15M, 11M); the coordinator merges the partials to 38M. That is fan-out/fan-in — the same shape as MPI Scatter/Reduce and MapReduce. COUNT, SUM, MIN and MAX are associative and reduce cleanly. AVG does not: averaging per-shard averages weights each shard equally regardless of row count, so each shard must return SUM and COUNT and the coordinator divides at the end.
6. Name the three parallel join strategies in order of cost.
Co-located — both tables sharded on the join key, so matching rows already share a node; zero network. Broadcast — one table is small enough to copy to every node. Shuffle — neither is co-partitioned, so both are re-sent and re-partitioned by the join key; the whole dataset crosses the network. Sharding both tables on the join key converts a shuffle join into a co-located one and can turn minutes into seconds without touching the query.
7. Why does Hadoop move the code to the data rather than the reverse?
With 1,000 GB spread over 100 machines, copying all of it to one machine saturates the network — the slowest component in the building. Sending a 5 KB program out to all 100 machines lets each process its local 10 GB, and only tiny results return. A program is kilobytes and the data is terabytes, so you always move the small thing. This is data locality, and it is data parallelism where the "cores" are whole machines.
8. Describe HDFS and give two reasons for replication.
HDFS splits a large file into blocks of roughly 128 MB and stores three copies of each block on different machines. Replication provides fault tolerance — in a cluster of thousands of cheap machines something is always broken, so a dead disk must be a non-event; Hadoop reads another copy and rebuilds a third. It also provides locality — three copies give the scheduler three chances to place a task on a machine that already holds the data.
9. Describe the MapReduce stages and write word count.
Input → Map (parallel, emits key/value pairs) → Shuffle & sort (framework groups all values by key across the cluster — the network-heavy step) → Reduce (parallel, one key plus all its values → output). Word count: map(line) emits (w, 1) for each word; reduce(w, list) emits (w, sum(list)). You write only map and reduce; the framework supplies parallelism, distribution and failure recovery. The restriction is the point — one shape means the hard problems are solved once for everyone.
10. What is a combiner, and why is it worth 12× on word count?
A combiner is a mini-reduce run locally on each mapper's output before the shuffle. Without one, word count on 1 TB emits 170 billion pairs (~2 TB across the network, ~2,000 s of shuffle, ~36 min total). With one, each mapper emits a single pair per distinct word (~12 GB, ~12 s of shuffle, ~3 min total). It is valid only when the reduce operation is associative and commutative — sum, max, count, but not average. Note it is the same principle as an OpenMP reduction: accumulate locally, combine once.
11. Why is Spark 10–100× faster than Hadoop on machine-learning jobs?
MapReduce writes to disk between every stage. Iterative workloads — and all ML — loop over the same data twenty or thirty times, so the job pays a full disk round-trip each pass. Spark keeps the working set in RAM across stages, and RAM is roughly 100× faster than disk. It adds RDDs (in-memory partitions rebuildable from lineage) and lazy DAG evaluation that optimises the whole plan before running. Hadoop is not dead though: HDFS remains a common storage layer and huge single-pass jobs still suit MapReduce.
12. Define a real-time system and distinguish hard from soft, with examples.
A real-time system is one whose correctness depends not only on the result but on when it arrives — a correct braking decision 50 ms late is the wrong decision. Hard: a missed deadline is a system failure — ABS brakes, airbags, pacemakers, flight control. Soft: a missed deadline degrades quality but is tolerable — video calls, game frame rate, live audio. Real-time is the exception to the course's usual framing: here predictable worst-case latency matters more than average speed.
13. Three tasks: (50 ms, 12 ms), (100 ms, 20 ms), (200 ms, 90 ms). Are they schedulable under RMS? Under EDF?
U = 12/50 + 20/100 + 90/200 = 0.24 + 0.20 + 0.45 = 0.89. RMS bound for n = 3 is 3(21/3−1) = 3(0.2599) = 0.779; since 0.89 > 0.779 the RMS test fails — though note the bound is sufficient but not necessary, so this proves only that the test cannot guarantee it. EDF's bound is U ≤ 1, and 0.89 ≤ 1, so EDF guarantees every deadline is met. EDF is optimal for uniprocessor periodic scheduling; RMS is simpler and more predictable but wastes up to ~30% of capacity.
14. Describe one federated learning round, and justify it with arithmetic.
(1) The server sends the current model to a sample of devices. (2) Each device trains locally on its own private data. (3) Devices send back only weight updates or gradients — never raw data. (4) The server aggregates them by Federated Averaging (a weighted mean) into a new model, and repeats. Arithmetic: 1M phones × 1,000 photos × 2 MB = 2 PB to centralise, roughly two days of continuous transfer at 100 Gb/s plus permanent storage and legal liability. Federated moves 1,000 devices × 20 MB = 20 GB per round, ~20 TB over 1,000 rounds — about 100× less data, with no personal data collected. Hard because devices have non-IID data, unequal compute, and drop offline mid-round.
15. Distinguish data, model and pipeline parallelism in distributed AI training.
Data parallelism — every GPU holds a full model copy and processes a different slice of the training data; gradients are combined with an Allreduce. Model parallelism — the model is too large for one GPU, so different layers live on different GPUs. Pipeline parallelism — batches are staggered like a factory line, so batch 1 is at layer 3 while batch 2 is at layer 1, keeping every GPU busy. Large models use all three at once. These are the data, task and pipeline decompositions of Unit I at the largest scale computing currently operates.
16. State the one idea that connects the whole course, and the three questions that never change.
"Split the work into independent pieces, run them at once, keep coordination cheap, and combine the results" — the same idea from thread to core to GPU to node to cluster to data centre to the planet, implemented by OpenMP, multicore, CUDA, MPI, MapReduce/Spark and federated learning respectively. The three questions: (1) What can run in parallel? — decomposition. (2) What is the ceiling? — Amdahl and the critical path. (3) How do I keep coordination cheap? — communication, load balance, coherence.
All unit notes ← Unit IV