Distributed and Parallel Computing
A large job can be divided into smaller jobs. Several processors or computers can then work on those parts.
Parallel computing runs parts of a job at the same time. Distributed computing uses separate computers connected by a network. A cloud uses both ideas to handle many users and tasks.
Parallel computing: one kitchen, several cooks, one shared fridge. Each cook makes one dish at the same time, so dinner is ready faster. Distributed computing: several separate restaurants in different areas, each with its own kitchen and fridge. They coordinate by phone calls (messages) so customers feel it is one food chain.
Parallel computing runs parts of a job at the same time using several processing elements. The aim is to finish the work faster. These elements may share memory or communicate through messages.
Distributed computing uses separate computers connected by a network. Each has its own memory. They send messages to share work and can provide one service to the user.
Why one processor was not enough
Increasing processor speed also increases heat and power use. Chip makers added more cores, processing units inside a chip. A program must divide its work to use several cores at the same time.
Large services such as search and online shopping handle more work than one computer can manage. They divide work between many servers. This is distributed computing.
flowchart LR
A[Single CPU<br/>one step at a time] --> B[Multi-core / SMP<br/>parallel computing]
B --> C[Clusters<br/>many machines on one fast network]
C --> D[Grid computing<br/>shared across organisations]
D --> E[Cloud computing<br/>on-demand, pay-per-use]
Parallel computing
Key ideas
- Decomposition – split a problem into parts that can run at the same time.
- Data decomposition: the same work on different pieces of data (for example four cores each check 25 % of a list of exam results).
- Task decomposition: different jobs at the same time (for example one core plays music while another downloads a file).
- Shared memory – all processors read and write the same memory. This is fast, but they must take turns when changing the same data, using locks or semaphores – like a single bathroom key in an office.
- Speed-up – how many times faster the parallel version is:
Speed-up S(p) = T(1) / T(p), where T(1) is the time on 1 processor and T(p) the time on p processors. - Efficiency – how well each processor is used:
E(p) = S(p) / p. If 4 processors give a speed-up of 3, efficiency is 3/4 = 75 %.
Flynn's taxonomy
Flynn sorted computers by two questions: How many instructions run at once? and On how many pieces of data?
| Class | Instruction streams | Data streams | Example | Everyday picture |
|---|---|---|---|---|
| SISD (Single Instruction, Single Data) | Single | Single | Old single-core PC | One teacher checking one answer sheet |
| SIMD (Single Instruction, Multiple Data) | Single | Multiple | GPU (Graphics Processing Unit), vector processors, AVX (Advanced Vector Extensions) instructions | One teacher says "add 5 marks" and 30 assistants apply it to 30 sheets at once |
| MISD (Multiple Instruction, Single Data) | Multiple | Single | Rare; different checks on one input stream | Three examiners checking the same sheet in different ways to be safe |
| MIMD (Multiple Instruction, Multiple Data) | Multiple | Multiple | Multi-core CPUs (Central Processing Units), clusters, clouds | Many teachers each checking different subjects at the same time |
“Explain Flynn's classification with examples.” Draw the 2×2 table above and give one real example per class. Point out that clouds are MIMD systems.
Amdahl's law – the limit of parallelism
A program often has steps that must run in order. This sequential part limits the benefit of adding processors. If f is the sequential fraction and p is the processor count, Amdahl's law gives:
S(p) = 1 / ( f + (1 − f) / p )
Even with infinite processors, the speed-up can never be more than 1 / f. If 10 % of a program is sequential, it can never run more than 10× faster, no matter how many cores you buy.
Parallel architectures
| Architecture | Memory | How parts communicate | Typical use |
|---|---|---|---|
| SMP (Symmetric Multi-Processing) | Shared; every processor reaches it equally fast | Shared variables | Multi-core servers |
| NUMA (Non-Uniform Memory Access) | Shared; nearby memory is faster than far memory | Shared variables | Large servers |
| MPP (Massively Parallel Processing) | Each node has its own memory | Messages (for example MPI (Message Passing Interface)) | Supercomputers |
| GPU | The graphics card's own memory | Thousands of small cores doing the same step (SIMD) | AI (Artificial Intelligence) training, graphics |
Distributed computing
Characteristics
- No shared memory – computers talk only by sending messages over a network.
- No global clock – each machine has its own clock, so knowing which event happened first is tricky (solved with ideas like Lamport clocks).
- Independent failures – one computer can crash while the others keep working (partial failure).
- Concurrency – many parts run at the same time.
- Heterogeneity – different hardware, operating systems and programming languages work together.
- Transparency – ideally the user sees one system, not many computers.
Forms of transparency
Transparency means hiding system details from the user. For example, you open a cloud file without choosing which server will send it.
| Transparency | Hides… | Example |
|---|---|---|
| Access | differences in how data is stored and accessed | Opening a file from the cloud feels the same as opening a local file |
| Location | where a resource physically is | You don't know which country your Google Drive file is stored in |
| Migration | that a resource may move to another place | Your video keeps playing while the server moves it |
| Replication | that several copies exist | WhatsApp keeps copies of your backup, you see one |
| Concurrency | that many users share the resource | Millions book IRCTC tickets at the same time, each sees their own booking |
| Failure | failures and recovery | A server crashes but the website still opens |
Architectural models
flowchart TB
subgraph CS[Client–server]
C1[Client] --> S1[(Server)]
C2[Client] --> S1
end
subgraph P2P[Peer-to-peer]
P1((Peer)) <--> P2((Peer))
P2 <--> P3((Peer))
P3 <--> P1
end
subgraph NT[Multi-tier]
U[Browser] --> W[Web tier] --> A[Application tier] --> D[(Database tier)]
end
- Client–server – clients ask, a server answers (websites, email, databases). Like customers and a shopkeeper.
- Peer-to-peer (P2P) – every computer is both client and server (BitTorrent, blockchain). Like friends sharing notes with each other directly.
- N-tier (multi-tier) – the app is split into layers: what you see (presentation), the business rules (logic) and the data (database). This is the main model for cloud applications.
- Service-oriented / micro-services – features offered as separate small network services (the topic of the next lessons: web services).
How the computers talk (communication mechanisms)
- Sockets – a basic connection that sends raw bytes (TCP (Transmission Control Protocol)/UDP (User Datagram Protocol)).
- RPC (Remote Procedure Call) / RMI (Remote Method Invocation) – call a function on another computer as if it were on your own (Java RMI, gRPC).
- Message-oriented middleware – messages are put into queues and picked up later (RabbitMQ, Kafka, Amazon SQS (Simple Queue Service)) – like a post box.
- Web services – SOAP (originally Simple Object Access Protocol) and REST (Representational State Transfer) over HTTP (Hypertext Transfer Protocol) – explained in detail in this module.
The CAP theorem
CAP means Consistency, Availability and Partition tolerance. A partition happens when groups of computers cannot exchange messages because a network link fails.
- Consistency: reads follow one up-to-date view of the data.
- Availability: every request to a working node receives a non-error response.
- Partition tolerance: the system must handle a broken network link between nodes.
During a network partition, a system cannot guarantee both consistency and availability. It may reject some requests to keep a consistent view, or answer requests while some copies may be out of date. This is not a general rule to “pick any two” in normal operation.
For example, two branches lose their connection. A system may pause updates that need agreement between the branches. Or it may accept local updates and reconcile differences later. The choice depends on the operation and the application's needs.
Parallel vs distributed computing
| Basis | Parallel computing | Distributed computing |
|---|---|---|
| Goal | Make one job faster | Share resources, grow big, survive failures |
| Coupling | Tightly coupled (closely joined) | Loosely coupled (independent) |
| Memory | May be shared or separate | Each computer has its own |
| Communication | Shared memory / bus | Messages over a network |
| Clock | One shared clock | No global clock |
| Location | Usually one machine or one rack | Can be in different buildings, cities, countries |
| Failure | Depends on the hardware and design | One computer can fail while others keep working |
| Examples | Multi-core CPU, GPU, supercomputer | The Web, email, DNS (Domain Name System), clouds, blockchain |
Challenges of distributed systems
- Fault tolerance – notice failures and recover (keep copies, send "I'm alive" heartbeats, retry).
- Scalability – add computers without redesigning; avoid one central point that slows everything.
- Consistency – keep all copies in agreement (using consensus algorithms such as Paxos and Raft).
- Security – check who is sending messages and protect them on untrusted networks.
- Latency – asking another computer over the network is thousands of times slower than reading your own memory.
Beginners wrongly assume: the network is reliable, delay is zero, bandwidth is infinite, the network is secure, the network layout never changes, there is one administrator, sending data costs nothing, and all computers are the same. All eight are false – good cloud design always plans for failure.
From distributed computing to cloud computing
| Stage | What it added |
|---|---|
| Cluster computing | A group of similar computers on a fast local network acting as one (for example Beowulf clusters). |
| Grid computing | Sharing different computers across organisations (for example CERN's LHC grid for physics data). |
| Utility computing | Paying for computing like electricity – by measured usage. |
| Virtualization | Many separate virtual machines on one physical server. |
| Cloud computing | All of the above together: virtual, on-demand, self-service, elastic, measured resources over the Internet. |
So, cloud computing is distributed computing offered as a service, with parallel hardware inside every server.
Summary
- Parallel computing runs many calculations at the same time inside one system to finish faster; its limits are explained by Amdahl's and Gustafson's laws.
- Distributed computing connects independent computers that talk by messages so they act as one system; it must handle partial failures, no global clock and unreliable networks.
- Flynn's taxonomy sorts computers into SISD, SIMD, MISD and MIMD.
- The CAP theorem forces distributed databases to choose between consistency and availability when the network breaks.
- Clusters → grids → utility computing → virtualization → cloud computing.
Practice questions
- Define parallel computing and distributed computing. Give two examples of each.
- Differentiate between parallel and distributed computing (any six points).
- Explain Flynn's taxonomy with a neat diagram.
- State Amdahl's law. A program is 20 % sequential – what is the maximum speed-up on 8 processors and on infinite processors?
- What is transparency in distributed systems? Explain any four types.
- Explain the CAP theorem with a real-world example.
- Trace the evolution from cluster and grid computing to cloud computing.
With f = 0.2: S(8) = 1 / (0.2 + 0.8/8) = 1 / 0.3 ≈ 3.33. With infinite processors: S = 1 / 0.2 = 5.
Create a free account to track your progress and unlock virtual labs.