Skip to main content
@shmVirus

Multiprocessor Systems

Compare shared and distributed memory, buses, multiport and crossbar systems, multistage and hypercube networks, arbitration, synchronization, coherence, and clusters.

Updated

Learning objectives

  • Explain performance and reliability motivations for multiprocessing
  • Compare tightly and loosely coupled organizations
  • Evaluate bus, multiport, crossbar, multistage, and hypercube connections
  • Compare static and dynamic bus arbitration
  • Use mailboxes, interrupts, test-and-set, and semaphores for coordination
  • Explain snooping cache coherence and cluster trade-offs

Prerequisites

  • Memory Hierarchy
  • Pipelining and Parallelism
  • Input Output Systems

A multiprocessor interconnects two or more CPUs with memory and I/O under one cooperating system. It is normally MIMD: processors execute different instruction streams on different data. Multiple autonomous computers linked only as a general network are not automatically one multiprocessor; the distinction is coordinated resource management and cooperation on system work.

TermDefinition
ConcurrencyTasks make progress during overlapping periods, even if not literally simultaneous.
ParallelismTwo or more operations execute physically at the same time.
ArbitrationSelection of one requester to own a contested physical resource.
Atomic operationAn indivisible action that no other processor can observe half-completed.
CoherenceAgreement among cached copies of each individual memory location.
ConsistencyThe allowed ordering in which memory operations become visible.

Why Multiple Processors?

  • Throughput: run independent jobs concurrently.
  • Speedup: partition one job into parallel tasks whose dependencies permit overlap.
  • Specialization: assign computation, I/O, signal processing, or control to suitable processors.
  • Reliability: continue with reduced performance when one processor fails.
  • Growth: add processing resources when the organization and software can scale.

Parallelizing software must identify data dependencies. Tasks that consume another task’s results must wait; independent tasks can be scheduled on different processors. More processors do not automatically yield proportional speedup because sequential work, communication, synchronization, and memory contention remain.

Amdahl’s law makes the limit numerical. If fraction ff of a program can use pp processors, ideal speedup is

S=1(1f)+f/p.S=\frac{1}{(1-f)+f/p}.

With f=0.80f=0.80 and p=4p=4, S=1/(0.20+0.20)=2.5S=1/(0.20+0.20)=2.5, not four. The untouched 20% sets a hard ceiling of 1/(1f)=51/(1-f)=5 even with unlimited processors.

Shared and Distributed Memory

Tightly coupled shared-memory multiprocessor and loosely coupled distributed-memory system with message packets
Shared memory communicates through loads and stores in one address space. Distributed memory communicates by routing packets between processor-local memories.
PropertyTightly coupledLoosely coupled
MemoryGlobal shared memory, usually private caches tooPrivate memory per processing element
CommunicationShared variables/mailboxesExplicit messages with address, data, error check
Task interactionEfficient for frequent sharingBest when interaction is limited
Main challengeContention and cache coherenceRouting and communication latency
Failure scopeMore shared dependenciesBetter node isolation

A processor element in a distributed system contains CPU, local memory, and I/O. A packet names a destination or service and carries content plus error-detection information.

Time-Shared Common Bus

Five processors sharing one memory bus and a dual-level organization with local processor memory buses linked through system-bus controllers to common memory
A single bus permits only one transfer at a time. Local buses let processors continue local memory and I/O work while one controller uses the shared system bus.

A bus master places an address and command on the bus; the addressed unit responds and data transfer follows. With several potential masters, arbitration chooses one requester. The common path is inexpensive and easy to broadcast/snoop, but its bandwidth limits scale.

A dual-bus organization attaches each CPU/IOP and local memory to a local bus, then uses a system-bus controller to reach common memory and shared I/O. Address decoding distinguishes local from global references. Adding fully independent buses allows simultaneous transfers but increases wiring and control cost.

Multiport Memory and Crossbar

Four CPUs connected to four memory modules by multiport buses and by a crossbar matrix of switch points
Both organizations offer multiple paths. Multiport memory moves arbitration into each module; a crossbar makes each processor-module crosspoint explicit.

In multiport memory, each CPU has a bus to a dedicated port on every module. A module resolves simultaneous requests to itself, often by fixed port priority. Different CPUs can access different modules concurrently. Transfer rate is high, but multiported modules, cables, and connectors are expensive.

An p×mp\times m crossbar contains pmpm crosspoints. Each addressed module selects one requesting processor through data, address, and control multiplexers plus arbitration. For four CPUs and four modules, 16 crosspoints allow up to four concurrent transfers when every CPU selects a different module. Requests for the same module still conflict.

Multistage Networks

A 2×2 interchange switch can pass inputs straight, cross them, or connect one requester while blocking a conflict. Networks of these switches provide many paths with less hardware than a crossbar.

Two by two interchange switch modes, a three-stage eight by eight omega network, and a three-dimensional hypercube labeled with binary node addresses
Omega routing consumes one destination bit per stage. Hypercube routing flips one differing address bit per link.

An N×NN\times N omega network for N=2nN=2^n has log2N=n\log_2N=n stages and N/2N/2 switches per stage, so total switches are

N2log2N.\frac N2\log_2N.

An 8×8 omega network has three stages of four switches, or 12 switches, far fewer than a 64-crosspoint crossbar. It offers exactly one path from a source to a destination, so some otherwise independent pairs block when they require the same internal link.

A binary nn-cube has N=2nN=2^n nodes, each with nn direct neighbors. Neighbor addresses differ in one bit. Routing from source ss to destination dd can use sds\oplus d: each 1 identifies a dimension that must be traversed. In a three-cube, 010 to 001 gives 011; one shortest route is 010 → 000 → 001.

InterconnectConcurrent pathsHardware growthBlocking?
Common bus1LowYes
Multiport memoryUp to modules/portsHigh inside memorySame-module conflict
CrossbarUp to min(p,m)\min(p,m)pmpm crosspointsOnly same destination
OmegaMany(N/2)log2N(N/2)\log_2N switchesYes
HypercubeDistributed neighbor linksNlog2N/2N\log_2N/2 linksRouting dependent

Bus Arbitration

Arbitration must provide mutual exclusion of bus ownership and a priority/fairness policy.

Daisy-chain and parallel bus arbitration beside an atomic test-and-set semaphore protecting a critical section
Arbitration protects the physical bus; a semaphore protects a logical shared resource. Both require one indivisible winner.

Static priority

  • Serial/daisy chain: priority-in/out passes through arbiters in fixed order. The first requester with priority and an idle bus captures it.
  • Parallel: request lines feed a priority encoder; a decoder enables the winning acknowledge. It is faster but requires centralized logic and more wires.

Common signals include bus priority in/out, common bus request, bus busy, individual bus request/acknowledge, and a bus clock.

Dynamic priority

PolicyRule
Round-robin/time sliceOffer equal fixed intervals cyclically
PollingController presents device addresses in programmable order
LRUHighest priority to the requester waiting longest since last service
FIFOServe requests in arrival order
Rotating daisy chainRecent owner becomes lowest priority

Static priority gives predictable latency to favored devices but can starve low-priority ones. Dynamic schemes improve fairness with additional state.

Communication and Operating-System Organization

In shared memory, processors can exchange messages through a mailbox: data plus status bits indicating valid content and destination. Polling finds messages eventually; a software-generated interprocessor interrupt alerts the receiver immediately. Other paths can link IOPs so each CPU treats the other side like an I/O device.

Operating-system responsibilities may be organized as:

  • Master–slave: one processor executes OS services; slaves request them.
  • Separate OS: every processor has its own OS copy, suitable for loosely coupled nodes.
  • Distributed/floating OS: functions are distributed and may migrate, but one processor owns a particular function at a time.

Distributed-memory communication names source and destination, establishes or selects a route, and sends a message header plus objects. Efficiency depends on topology, routing protocol, processor speed, and link bandwidth.

Synchronization and Mutual Exclusion

Communication exchanges data; synchronization exchanges control information to order events. A critical section accesses shared writable state and must execute with mutual exclusion.

A binary semaphore SEM uses 0 for available and 1 for held. Merely reading and later writing it is unsafe: two CPUs could both read zero. A test-and-set-while-locked instruction performs atomically:

RM[SEM],M[SEM]1.R\leftarrow M[\text{SEM}],\qquad M[\text{SEM}]\leftarrow1.

If returned R=0R=0, this processor acquired the resource; if R=1R=1, another owns it. The hardware lock needs to cover only the indivisible read-modify-write. The semaphore remains one until the owner completes the critical section and stores zero.

repeat:
    old ← test_and_set(SEM)
until old == 0
critical section
SEM ← 0

This spin lock is suitable only for short waits. Longer waits should block and let the scheduler run another task.

Cache Coherence

Private caches may hold copies of the same shared address. If core 1 writes X=9 while core 2 keeps cached X=4, core 2 can compute with stale data unless the coherence mechanism acts.

Two private caches snooping a shared bus with write-invalidate and write-update paths, beside a cluster of independent nodes on a fast network
Snooping exploits a broadcast bus to observe other caches' transactions. A cluster instead has separate memories and exchanges explicit network messages.

Every cache controller snoops shared-bus transactions for blocks it holds. Coherence has two obligations: propagate a processor’s write and determine which copy may supply the current value.

  • Write-invalidate: a writer obtains ownership and broadcasts invalidation; other caches mark their copies invalid. Later readers miss and fetch the new value.
  • Write-update: a writer broadcasts the new data so other cached copies update. This generates traffic on every write, similar in spirit to write-through.

Coherence concerns one memory location’s copies. Consistency is the broader rule for when writes to different locations become visible and in what order.

Bus Multiprocessors, Networks, and Clusters

A shared bus has low cost, simple protocols, and efficient broadcast, but one path and one memory module impose bandwidth limits. Caches reduce average latency and bus traffic, yet misses and coherence transactions still consume the bus. Networks provide aggregate bandwidth and many simultaneous routes for larger systems.

A cluster is a group of complete computers connected by a fast local network and configured to work as one service or computational resource.

Cluster advantagesCluster costs/limits
High availability and failoverMore servers, network, monitoring, and administration
Scale out by adding nodesSoftware must partition data/work and handle failure
Maintain one node while others serveNot every application or server design clusters well
Commodity componentsNN memories and often NN OS instances; no simple shared address space

A shared-address multiprocessor can let one program use almost all installed memory, while a cluster has independent node memories. Conversely, cluster failure isolation and incremental growth can be stronger.

Memory interleaving complements either design: consecutive shared addresses distributed over modules raise bandwidth, but it does not by itself solve cache coherence or synchronization.

Check Your Understanding

  1. How many crosspoints connect 8 CPUs to 16 memory modules?
  2. How many stages and total 2×2 switches does a 16×16 omega network need?
  3. Which nodes neighbor 101 in a three-cube?
  4. Why must test-and-set be indivisible?
  5. What happens to core 2’s copy after core 1 writes under write-invalidate?
Answers
  1. 8(16)=1288(16)=128.
  2. Four stages, eight switches per stage, 32 total.
  3. 001, 111, and 100.
  4. Otherwise several processors can observe zero and all enter the critical section.
  5. It becomes invalid; core 2’s next read misses and obtains the current value.