Part I

Characterization of Distributed Systems

What a distributed system is, why anyone builds one, and the eight challenges every designer has to face. This Part gives you the vocabulary the rest of the subject is written in, and its centrepiece, the eight kinds of transparency, is one of the most examined topics in the whole course.

  • You willdefine a distributed system two ways (CDK and Tanenbaum) and tell it apart from a computer network.
  • You willexplain the consequences of distribution: concurrency, no global clock and independent failures.
  • You willname, define and illustrate all eight challenges, including all eight transparencies.
  • You willapply the challenges to any scenario, the way a 5-mark "with respect to this example" question demands.
1.1

What Is a Distributed System? exam

Before we can talk about how to build distributed systems, we need to agree on what one is. The question sounds easy, but there are two standard definitions, and they look at the same thing from opposite ends: one from the inside (how the parts work together) and one from the outside (what the user experiences). The exam expects you to know both.

Definition 1: Coulouris (CDK), the mechanism

Definition · CDK

A distributed system is one in which hardware or software components located at networked computers communicate and coordinate their actions only by passing messages.

A component here is any running piece of the system: a program, a server, a database. A networked computer (also called a host) is a machine joined to others by a network. A message is a sequence of bytes that one process sends to another over that network. The word that carries the whole definition is "only". The computers have no shared memory: a program on one machine cannot simply read a variable that lives on another. Everything one part learns about another, it learns by receiving a message. As you will see in 1.3, every difficulty in this subject follows from that one restriction.

no shared memory, no shared clock HOST 1 a laptop component A own CPU, own memory HOST 2 a phone component B own CPU, own memory HOST 3 a server component C own CPU, own memory NETWORK 1 · request (A to C) 2 · reply (C to B)
Messages are the only glue. Each component has its own processor and memory; the colours just tell the three apart. Nothing crosses from one host to another except messages on the network, so to find out anything about component C, component A must ask and wait for an answer.

Definition 2: Tanenbaum, the user's view

Definition · Tanenbaum

A distributed system is a collection of independent computers that appears to its users as a single (coherent) computer.

This definition says nothing about messages. It describes the goal: however many machines are really involved, the user should feel they are using one system. That idea is called a single-system image, and the general property of hiding the separate parts is called transparency. Transparency is the most examined idea in this Part and has its own section, 1.9.

WHAT IS REALLY THERE web 1 web 2 database payments network
Inside: four independent computers, joined by a network.
WHAT THE USER SEES user bookstore.com one coherent system (how many machines? who cares) the multiplicity of computers is hidden
Outside: one system. Tanenbaum's definition is about this view.
CDK stresses

The mechanism: components cooperate only by passing messages. No shared memory.

Tanenbaum stresses

The user's view: many computers that look like one. A single-system image, i.e. transparency.

The computers can be on different continents or in the same room; the definitions don't care about distance. What matters is that they cooperate on one task or service.

Lamport's quip: what it feels like from the inside

Leslie Lamport, a founder of the field, joked that a distributed system is one in which your work stops because "some machine I have never heard of has crashed". The joke packs in two serious ideas. The first is independent failure: one machine can die while everything else keeps running. The second is hidden dependency: your work quietly relies on machines you never knew existed. The stepper below acts out the lecturer's example, a crashed DHCP server. (DHCP, the Dynamic Host Configuration Protocol, is the service that hands a computer its IP address, the number that identifies it on the network, when it joins.)

Lamport's quip, acted out: a machine you never heard of crashes
time your PC DHCP server "never heard of it" file server crashes (nobody tells you) 1 · "I need an IP address" timeout: no reply, so no IP address 2 · open my files? can't even send: no address your work stops
  1. Three machines. You only know about your PC and the file server holding your work. The DHCP server is invisible to you.
  2. Somewhere in the building, the DHCP server crashes. Nothing tells you: the other machines keep running. That is an independent failure.
  3. You switch on your PC. Its first act is to ask for an IP address. The request goes nowhere, because the machine that should answer is dead.
  4. After waiting, the PC times out. It has no IP address, so it cannot identify itself on the network.
  5. Now you try to open your files. Without an address the PC cannot even send the request. A machine you had never heard of has stopped your work: a hidden dependency.

A computer network is not a distributed system exam

Every distributed system runs over a computer network, which makes the two easy to confuse. The difference is what each one is for and what it lets you see. A computer network is the plumbing: a medium that moves messages between computers using protocols (agreed rules for formatting and exchanging messages), such as TCP and UDP running over IP, the Internet Protocol. (TCP gives a reliable stream of bytes, UDP sends single unreliable packets; Part III covers both.) In a network the computers are visible and explicitly addressed: you name the machine you want by its IP address. A distributed system is built on top of a network and uses it to provide applications and services, and it hides the fact that many computers are involved.

COMPUTER NETWORK router 10.0.0.5 10.0.0.9 10.0.0.7 to: 10.0.0.9 | data
A network exposes its computers. Every host has a visible address, and a packet names its destination explicitly. The concern is packets and routing.
DISTRIBUTED SYSTEM user online bookstore web inventory payments hidden from the user BUILT ON TOP OF A NETWORK
A distributed system hides them. The user sees one service; the machines inside are transparent. The concern is applications and resource sharing.
Computer networkDistributed system
WhatA medium interconnecting computers so they can exchange messages via protocols (TCP/UDP over IP)Autonomous computers cooperating to provide applications and services
VisibilityEntities are visible and explicitly addressed (IP address)The multiplicity of computers is transparent (hidden)
FocusPackets, routingApplications, services, resource sharing
RelationProvides communicationBuilt on top of a network; every DS relies on one

The two share some problems, such as openness and reliability, but they tackle them at different levels: a network worries about whether a packet arrives, a distributed system about whether a service keeps working. And because a distributed system sits on top of a network, its designer must never assume the network is 100% reliable.

How this is examined

"Explain the difference between a computer network and a distributed system" is Tutorial 1's second question, and the official answer turns on one contrast: visibility versus transparency. In a network the computers are visible and addressed by IP; in a distributed system the separation and the communication are hidden from users. For full marks, add that every distributed system relies on a network's services.

Parallel systems versus distributed systems

The lecturer's notes also compare distributed systems with parallel systems, machines built to run one computation faster by using many processors. Parallel systems come in two kinds. A multiprocessor has several CPUs that share memory over a common bus; an SMP (symmetric multiprocessor), like a multi-core desktop, is the example. A multicomputer has no shared memory: each node has its own, and the nodes are joined by a fast interconnect. MPPs (massively parallel processors) and clusters are examples, and they use homogeneous (identical) hardware and software.

MULTIPROCESSOR (SMP) CPU CPU CPU shared bus one shared memory shared memory, one machine MULTICOMPUTER (MPP, CLUSTER) CPU memory CPU memory CPU memory fast interconnect no shared memory, identical nodes DISTRIBUTED SYSTEM laptop phone server NETWORK no shared memory, all different
Read left to right as "less and less shared". A multiprocessor shares memory; a multicomputer shares nothing but uses identical nodes; a distributed system shares nothing and its nodes can all be different. The line between the last two is blurring, as the text explains.

The boundary between parallel and distributed is blurring. A cluster that is extended over the years ends up with several generations of hardware, so it becomes heterogeneous (made of different kinds of machine). And desktop grids such as SETI@home do parallel computation on ordinary home PCs by harvesting their idle processor cycles, which is a distributed system doing a parallel system's job.

Check yourselfWhich statement best captures the difference between the CDK and Tanenbaum definitions?
  1. CDK requires the computers to be far apart; Tanenbaum allows them in one room.
  2. CDK describes the mechanism (message passing only); Tanenbaum describes the user's view (it looks like one computer).
  3. CDK allows shared memory; Tanenbaum does not.
  4. They are the same definition in different words.

B. CDK is about how the parts cooperate: only by passing messages, so no shared memory (which rules out C). Tanenbaum is about what users experience: a single coherent system, i.e. transparency. Neither definition cares about distance (A is wrong), and they emphasise different things (D is wrong).

Check yourselfSelf-test Q2: Compare the CDK and Tanenbaum definitions, and a DS with a network.

CDK's definition is about the mechanism, message passing, whereas Tanenbaum's is about the user's view: the system appears as a single computer, which is transparency.

A network moves packets between hosts that are explicitly addressed. A distributed system is built on top of a network, is focused on applications, and hides the multiplicity of computers.

Check yourselfEd practice quiz: a browser talks to a single web server over HTTP. Is that a distributed system?

Yes. It is independent computers (the user's machine and the server) coordinating solely by message passing to deliver one service, which is exactly the CDK definition. The number of machines, whether anything is replicated, and whether the server is multithreaded are not part of the definition, so "only two machines" doesn't disqualify it.

In short
  • CDK: networked components that communicate and coordinate only by passing messages (the mechanism).
  • Tanenbaum: independent computers that appear to users as a single computer (the user's view, i.e. transparency).
  • A network exposes and addresses its computers; a DS is built on a network and hides them.
  • Lamport's quip shows independent failure and hidden dependency: a machine you never heard of can stop your work.
1.2

Why Build One? Resource Sharing exam

Distributing a system makes it harder to build (the rest of this Part is a catalogue of how much harder), so there had better be good reasons. This section gives them, and then defines the vocabulary of resource sharing, the main reason of all, whose terms are examined as definitions.

The main motivation: resource sharing

According to CDK, resource sharing is the main motivation for building a distributed system. Beyond that, two course sources each give five practical reasons: the lecture slides and the official Tutorial 1 answer. Their lists overlap but are not identical, so combined they give six. They are ordered below from most to least compelling, and each is tagged with where it comes from.

1 · Scalability both sources load + more spread the load; grow by adding machines 2 · Reliability both sources copy site 1 site 2 copies at several sites tolerate faults 3 · Availability tutorial only down up the site stays up when one server crashes 4 · Inherent distribution slides only head office store store store the activity is naturally spread out 5 · Functional separation both sensors processing client different computers, different jobs 6 · Economy both sources one printer share expensive things, combine cheap ones
Six reasons, most compelling first. The gold tag says which source gives each reason: "both" means the slides and the official Tutorial 1 answer agree. Colours: blue is a client, red a server, green stored data, gold a source of data such as sensors.
  1. Scalability (both sources; the slides call it "power imbalance" or "load variation"). One machine can't cope, so the load is spread over several, and capacity grows by adding machines. Distributing a big computation over many computers is the example.
  2. Reliability (both). Keeping copies at several sites lets the system tolerate faults, as with long-term preservation and backup, or replicated servers.
  3. Availability (tutorial only). Replicas keep the service up when one of them fails, which gives high uptime: a website stays up when one of its servers crashes.
  4. Inherent distribution (slides only). Sometimes the information, people or activity is naturally spread out: web pages written by different authors, virtual teams working together (CSCW, computer-supported cooperative work), or a supermarket chain's stores and inventory.
  5. Functional separation (both). Computers have different capabilities and purposes, so dividing the work between them gives modularity. Clients and servers are one example; sensors that collect data, separate from the computers that process it, are another.
  6. Economy (both). Expensive resources can be shared and cheap machines combined: one printer for many users, or a "supercomputer" built from networked PCs.
Exam technique

The order above is the study guide's judgement, not the course's. If a question asks for a fixed number of reasons ("give three reasons…"), lead with the ones both sources give: scalability, reliability, functional separation and economy. Mentioning resource sharing as the overall motivation is a good opening line.

The vocabulary of resource sharing exam: definitions

Because resource sharing is the point, the words used to describe it are examined as definitions. Learn these four precisely; the rest of the subject uses them constantly.

Resource

Anything that can usefully be shared. It may be hardware (printers, disks) or a software entity (files, databases, objects, media streams).

Service

A distinct part of a system that manages a collection of related resources and presents their functionality only through a set of exported operations. A file service, for example, offers read, write and delete.

Why "only through exported operations"? Because that matches physical reality. A resource, such as a disk, sits inside one computer, and other computers can reach it only by sending a message that asks for one of the service's operations. They can never touch the disk directly.

Server and client

A server is a running process that accepts requests from programs on other computers to perform a service, and responds to them. The client is the requesting process. One complete interaction, from the client sending its request to it receiving the reply, is a remote invocation.

A process is simply a running program. Notice that a server is a process, not a machine: in everyday speech people call the computer "the server", but in this subject the word means the program.

CLIENT HOST client process active, short-lived starts the interaction SERVER HOST service interface read() write() delete() file server process passive: waits for requests runs continuously RESOURCES managed only by the service 1 · request: read(f, ...) 2 · reply: the data one remote invocation
The service is the interface, the server is the process, the resources sit behind both. The client (blue) can only reach the files (green) by asking the server (red) to run one of the exported operations. Request plus reply together make one remote invocation.

Clients and servers behave differently. Clients are active and short-lived: they start an interaction and finish when they have their answer. Servers are passive, waking only when requests arrive, and they run continuously.

Most importantly, client and server are roles in a single request, not fixed identities. A server can itself be a client of another server. In an object-oriented system the same idea appears as client objects invoking methods on server objects, which is what remote method invocation is about (Part VI).

browser web server database server request reply query rows client server client server teal: roles in the first request · gold: roles in the second request the web server is a server and a client at the same time
Roles belong to a request, not to a machine. In the teal request the web server is the server; in the gold request it is the client of the database.
Check yourselfTutorial 1, Q3 (official answer): List three reasons for using a distributed system.

This is the tutors' official answer, which staff confirmed is examinable. Any three of: economy (cost-effective), reliability (fault tolerance), availability (high uptime), scalability (extendible) and functional separation (modularity). The overall motivation is resource sharing, whether of hardware (disks, printers, scanners), software (files, databases) or other resources (processing power, memory, bandwidth).

Check yourselfSelf-test Q3: Give five reasons for building a DS.
  1. Functional separation. Different computers take different roles, such as client and server.
  2. Inherent distribution. The information or activity is naturally spread out, as with web pages, CSCW and chains of stores.
  3. Load beyond one machine (scalability). When one computer can't cope, the work is spread over several.
  4. Reliability. Replicas and backups at several sites let the system tolerate faults.
  5. Economies. Expensive resources such as printers can be shared, and PC clusters can act as supercomputers.

Behind all of these is the overall motivation, resource sharing.

Check yourselfWhich is the correct definition of a service?
  1. A computer that stores shared files.
  2. A running process that accepts requests from other computers.
  3. A distinct part of a system that manages a collection of related resources and presents their functionality only through a set of exported operations.
  4. Any hardware or software entity that can usefully be shared.

C. B is the definition of a server (a process), D is the definition of a resource, and A confuses the machine with the service. The key phrase for a service is "only through a set of exported operations".

In short
  • Resource sharing is the main motivation; the six practical reasons are scalability, reliability, availability, inherent distribution, functional separation and economy.
  • A resource is anything shareable; a service manages resources and exposes them only through exported operations; a server is the process that performs it; a client is the process that asks.
  • Client and server are roles in one request, so a server can be a client of another server.
1.3

Consequences, Characteristics & Goals exam

The CDK definition said components cooperate only by passing messages. That single word has consequences: the moment you spread a system over several computers, you inherit a set of problems you never had on one machine. This section names them, and they are the reason every later Part exists.

communicate only by messages (the CDK definition) 1 · Concurrency computers run at the same time, so shared access needs coordination 2 · No global clock clocks agree only roughly, because message delays vary 3 · Independent failures one part fails, the rest run on; failed and slow look the same 4 · Heterogeneity machines, OSs, networks differ; the slides' fourth consequence
One cause, several consequences. The three solid boxes are CDK's consequences and follow directly from "only by messages". The dashed box is the extra one the lecture slides add; a question asking for four consequences expects it.

1. Concurrency

The computers are autonomous: each runs on its own and coordinates with the others only by exchanging messages. So concurrent execution, many things happening at the same time, is the normal state of affairs rather than a special case. The catch is that when several of them use the same resource (a file, a bank balance, the last copy of a book), access to shared resources must be coordinated, or they will trample each other's work. The upside is real too: you can increase capacity simply by adding computers. Concurrency as a challenge comes back in 1.8.

2. No global clock

Programs often need to agree on when something happened: which bid arrived first, which file version is newer. On one computer that's easy, because there is one clock. In a distributed system every computer has its own clock, and clocks drift apart. They can be synchronised, but only to a limited precision, which the lecturer puts at milliseconds at best. The reason is again messages: the only way to tell another computer the time is to send it a message, and message delays vary, so the receiver never knows exactly how old the time it was told is.

time server node B send "it is 10:00:00.000" arrives after 2 ms? or after 40 ms? B can't know how stale the time it was told is
Why sync is imprecise. The time message itself takes an unknown time to arrive, so the receiver's corrected clock is off by up to that uncertainty.
p1 p2 send "x = 5" x becomes 7 receive: "p2 has x = 5" true now: x = 7. p1's view is already stale
No global state. Everything a process learns about the others arrives late, in messages, so no process can know the current state of the whole system.

Here is what that means in practice. Two nodes each write a log entry stamped with their own clock. Each clock is a little wrong, and in different directions, so the timestamps can put events in the wrong order.

real time 10:00:01 10:00:02 10:00:03 10:00:04 10:00:05 10:00:06 node A node B log: 10:00:05 log: 10:00:03 A's clock runs 3 s fast B's clock runs 1 s slow logs say B first; reality says A first
Timestamps from different clocks can't be compared. The dotted lines show when each event really happened. The numbers are made up for illustration; the point is that, without a global clock, the timestamps alone tell you nothing about the real order.

3. Independent failures

On one computer, a crash takes everything down at once. In a distributed system one component can fail while the others keep running, and the others don't find out straight away. A network fault, for instance, isolates computers without stopping them: both sides carry on, each unable to hear the other. The truly hard part is that a program can't tell a failed network from a slow one, or from a crashed server: in every case, the reply just hasn't arrived. The stepper shows three different worlds that look identical from the client's side.

Crashed, lost or slow? Three worlds the client can't tell apart
case Acase Bcase C A · network lost it B · server crashed C · server just slow client server client server client server request request request lost on the way crashes mid-request still working... late reply timeout timeout timeout at the timeout, all three clients see exactly the same thing: silence
  1. Three parallel worlds, each with a client (blue) and a server (red). Watch what each client can actually observe.
  2. In every world the client sends the same request and starts waiting.
  3. Case A: the network loses the request. The server never hears of it and is perfectly healthy.
  4. Case B: the request arrives, but the server crashes while handling it. No reply will ever come.
  5. Case C: the server is fine but slow (overloaded, perhaps). Its reply is on its way, but it will arrive late.
  6. Each client's timeout expires with no reply. A message-only system gives the client no way to look inside the network or the server, so it can't tell which world it is in. This is why a crashed remote server can be suspected but never certainly detected (1.8).

4. Heterogeneity (the slides' addition)

The lecture slides add a fourth consequence: heterogeneity, meaning the computers, operating systems, networks and programming languages involved can all be different. CDK treats this as a challenge rather than a consequence (see 1.6), but a question asking for four consequences expects it.

Characteristics and goals (slides)

The slides also list the characteristics of a distributed system, which restate the consequences from a slightly different angle. Its activities run in parallel and interact by message passing, since there is no shared memory; its resources are shared; there is no global state (no process can know the current state of the whole system, because everything it learns arrives late, in messages); and there is no global clock.

Finally, the slides give the goals of a distributed system: connecting users and resources, transparency, openness, scalability, enhanced availability, and concurrency. Most of these reappear as the challenges of 1.5, which makes sense: a goal is just a challenge you have met.

consequence

Concurrency

Coordinate access to shared resources. Bonus: add computers to add capacity.
consequence

No global clock

Clocks sync only to limited precision (ms at best), because message delays vary.
consequence

Independent failures

Parts fail alone, others don't know at once; failed and slow look alike.
characteristic

No global state

Nobody can know the whole system's current state; news arrives late.
Check yourselfSelf-test Q1: Define a DS and give its three consequences.

CDK defines a distributed system as one in which components located at networked computers communicate and coordinate their actions only by message passing. Three consequences follow. The first is concurrency: access to shared resources must be coordinated. The second is that there is no global clock, because synchronisation is limited by variable message delays. The third is independent failures: a component can't tell a crash from a slow network.

Check yourselfTutorial 1, Q4 (official answer): Briefly explain four consequences of using distributed systems.

The tutors' official answer (examinable) names four: concurrency, heterogeneity, no global clock, and independent failures. CDK lists only three; heterogeneity is the slides' addition, and a question asking for four expects it as the fourth. Explain each in a line: concurrent execution means shared resources need coordinated access; heterogeneity means different hardware, OSs, networks and languages must interoperate; there is no single clock, and clocks can be synchronised only to limited precision because message delays vary; and a component can fail while the rest keep running, without them knowing at once.

Check yourselfEd practice quiz: node A logs an event at 10:00:05 by its clock, and node B logs one at 10:00:03 by its clock. You may conclude…
  1. B's event happened two seconds before A's.
  2. A's event happened after B's, but by an unknown amount.
  3. Nothing about their real order.
  4. The events were concurrent.

C. Nothing about their real order. There is no global clock and local clocks drift, so timestamps taken on different machines can't be compared. The figure above shows a world in which A's event really came first despite its later timestamp.

Check yourselfA client has sent a request and received no reply after 30 seconds. Which conclusion is justified?

Only that no reply has arrived yet. The request may have been lost, the server may have crashed, the reply may have been lost, or the server or network may just be slow. This is the "independent failures" consequence: in a message-only system a failed network (or server) can't be told apart from a slow one, so the client can at best suspect a failure.

In short
  • "Only by messages" causes three consequences (CDK): concurrency, no global clock and independent failures. The slides add heterogeneity as a fourth.
  • Clocks synchronise only to limited precision because message delays vary; there is also no global state.
  • A program can't tell a crashed server or failed network from a slow one: all it sees is silence.
1.4

Examples and Trends

Definitions are easier to hold onto when you can picture real systems. This section tours the examples CDK uses, the Internet that most of them run on, and the four trends that are shaping today's distributed systems. The examples are background; the trends are examinable.

Where distributed systems appear

Almost every application domain relies on them: finance (eCommerce, banking), the information society (search engines, social networks), entertainment (online games, streaming), healthcare (patient records), education (e-learning), transport (GPS, maps), science (grids and clouds for big computations) and the environment (sensor networks that give flood warnings). CDK picks three to study, because each shows a different side of the subject.

CDK's three examples

example 1

Web search (Google)

Runs on data centres worldwide. Relies on a distributed file system for huge files, structured distributed storage, a lock service for locking and agreement, and a programming model for very large parallel computations.
example 2

Massively multiplayer online games

MMOGs need fast response and a consistent shared world for thousands of players. Three designs exist; see the figure.
example 3

Financial trading

Event-based: adapters translate many feeds into one format, and Complex Event Processing spots patterns to trade automatically.
1 · CENTRALIZED EVE Online server cluster one copy of the world single copy: consistency is easier 2 · PARTITIONED EverQuest serverzone 1 serverzone 2 serverzone 3 the world is split across servers 3 · PEER-TO-PEER no server: players share the work
Three ways to host one shared world. Players' machines are blue, servers red. Centralized keeps one copy of the state, which makes consistency easier; partitioning spreads the load across servers; peer-to-peer drops the servers altogether.
Reuters feed FIX feed adapter adapter eee events, one format Complex Event Processing detects patterns trade heterogeneous inputs automatic decisions
Adapters absorb heterogeneity. Each feed has its own format (gold); an adapter (violet) translates it into one common event format, so the Complex Event Processing engine only has to understand one thing.

The Internet and intranets

The Internet is a vast collection of interconnected networks of many types, and it is itself a huge distributed system with open-ended services. An intranet is a portion of the Internet that is separately administered by one organisation and protected by a firewall, a filter at its boundary that blocks messages by their source, destination or protocol. Firewalls can also block legitimate sharing, however, so finer-grained security mechanisms are needed too (Part X). ISPs (Internet Service Providers) connect individual users and organisations to the Internet, and backbones, high-capacity network links, connect the intranets to each other.

INTRANET (ONE ORGANISATION) desktop desktop desktop file server local network firewall the firewall filters messages by source, destination or protocol INTERNET backbone ISP home user OTHER INTRANET
The Internet is a network of networks. Each intranet is run by one organisation and guarded by a firewall (gold) at its edge; backbones join the intranets, and ISPs (brown) bring in home users.

Four trends exam

Four developments are reshaping distributed systems. For each, know what it is and what new challenge it brings.

1. Pervasive networking and the modern Internet

Many kinds of network, such as WiFi, Bluetooth and cellular, are all abstracted by the Internet protocols, so a device can connect anywhere, at any time, without its software caring which kind of network it is on.

2. Mobile and ubiquitous computing

These overlap but are distinct. Mobile computing is computing while on the move or away from home, with continued access to your home intranet. Using resources that happen to be nearby, such as the printer in the hotel you are visiting, is called location-aware or context-aware computing, and its challenges are variable connectivity and outright disconnection. Ubiquitous computing means many small, cheap computing devices embedded in everyday objects, so many that they are scarcely noticed. A device visiting such an environment needs spontaneous interoperation (working with devices it has never met, without set-up) and service discovery (finding out which services are available here).

HOST INTRANET (HOME) your files, email, home services Internet VISITED SITE (E.G. A HOTEL) visiting laptop local printer thermostat camera use what's nearby discover services embedded devices
Mobile versus ubiquitous. Mobility is the laptop (blue) keeping its link home across the Internet while it uses the local printer (location-aware computing). Ubiquity is the room full of embedded devices (brown) that a visitor must discover and work with spontaneously.

3. Distributed multimedia

These systems support continuous media, such as audio and video, as well as discrete media (text, pictures). Continuous media have a temporal dimension: a video is only correct if its frames arrive at the right rate and within a maximum delay. That is a question of quality of service (QoS; see 1.8). Webcasting is an example. To manage this, a system needs an extensible range of encoding formats, QoS mechanisms, resource scheduling, and a way to adapt when the required QoS can't be met.

4. Distributed computing as a utility (cloud)

Here computing resources are rented, not owned, the way you rent electricity from the grid instead of running your own generator. The resources can be physical, namely storage and processing (often on virtualized nodes, i.e. simulated machines carved out of real ones), or software services. A cloud is a set of Internet-based application, storage and computing services sufficient for most users' needs; the idea is "everything as a service", paid for per use. Clouds run on clusters: interconnected commodity or blade computers that cooperate to give one high-performance capability. Grid computing, aimed at science, was a precursor.

clients Internet THE CLOUD rented, pay per use applicationsoftware services storagefiles, databases computationprocessing power CLUSTER OF VIRTUALIZED NODES
Everything as a service. Clients rent application, storage and computing services (top row), which run on a cluster of commodity machines (bottom), and pay per use rather than owning the hardware.
Check yourselfWhat is the difference between mobile computing and ubiquitous computing, and what does a device visiting a ubiquitous environment need?

Mobile computing is computing on the move or away from home, keeping access to your home intranet and using nearby resources (location- or context-aware computing); its challenges are variable connectivity and disconnection. Ubiquitous computing is many small, cheap devices embedded in everyday objects, scarcely noticed. A visiting device needs spontaneous interoperation and service discovery.

Check yourselfWhy does distributed multimedia raise a problem that ordinary file transfer doesn't?

Continuous media (audio, video) have a temporal dimension: frames must arrive at a set rate and within a maximum delay, or the result is wrong even if every byte eventually arrives. That needs quality-of-service guarantees, resource scheduling and adaptation when QoS can't be met. A file transfer only needs the bytes to arrive correctly, however long it takes.

In short
  • CDK's examples: web search (DFS, distributed storage, lock service, parallel programming model), MMOGs (centralized, partitioned or peer-to-peer) and financial trading (adapters plus Complex Event Processing).
  • An intranet is a separately administered part of the Internet behind a firewall; ISPs and backbones join everything up.
  • Four trends: pervasive networking, mobile and ubiquitous computing, distributed multimedia (QoS for continuous media) and computing as a utility (cloud: rented, not owned).
1.5

The Eight Challenges at a Glance exam

Everything so far has explained why distributed systems are attractive and why they are awkward. The design problems that result are organised as a list of challenges, and this list is the core of the Part. CDK lists eight; the slides' summary lists the first seven and leaves out quality of service. Sections 1.6 to 1.9 take them one at a time; here is the whole set, with the question each one asks of a scenario.

a distributed system 8 challenges 1 · Heterogeneity Must different machines, OSs, networks or languages interoperate? 2 · Openness Can new services, devices or vendors be added through published interfaces? 3 · Security What is sensitive? Who must be authenticated? What could be disrupted? 4 · Scalability What breaks when users grow 1000×? Where is the bottleneck? 5 · Failure handling What if a server, link or client crashes mid-task? 6 · Concurrency Which shared resources are used at the same time? 7 · Transparency What should users not need to know? (where, copies, failures, movement) 8 · Quality of service CDK only Are timeliness or performance guarantees needed?
Eight questions to ask of any scenario. Each card is a challenge with the question that exposes it. The dashed card, quality of service, is in CDK but not in the slides' summary.
ChallengeQuestion to ask of the scenarioMain remedies
HeterogeneityMust different machines, OSs, networks or languages interoperate?Internet protocols, middleware, virtual machines, standards
OpennessCan new services, devices or vendors be added through published interfaces?Published interfaces, standards
SecurityWhat is sensitive? Who must be authenticated? What could be disrupted?Encryption, authentication, access control
ScalabilityWhat breaks when users grow 1000×? Where is the bottleneck?Replication, caching, hierarchy, decentralization
Failure handlingWhat if a server, link or client crashes mid-task?Detect, mask, tolerate, recover, redundancy
ConcurrencyWhich shared resources are used at the same time?Synchronization, transactions
TransparencyWhat should users not need to know (where, how many copies, failures, movement)?Middleware, naming (DNS)
Quality of serviceAre timeliness or performance guarantees needed?Resource reservation, adaptation

The scenario technique exam

A favourite exam question gives you a scenario (a campus computer lab, an online shop, a ride-sharing app) and says "list and explain N challenges with respect to this example". The marks go to answers that are tied to the scenario, not to a recited list. The reliable way to get them is to take each challenge through four steps.

The four-step recipe for each challenge
  1. Name it. "Scalability."
  2. Define it in one line. Show the marker you know what the word means.
  3. Give a concrete instance from the scenario. This is the step people skip, and it is where the "with respect to this example" marks live.
  4. Give a remedy. One named technique is enough.

Each challenge is usually worth one mark, for a definition plus its application to the scenario. Worked examples are in 1.10.

Building a one-mark answer: scalability in a campus computer lab
1 · Name 2 · Define 3 · Instance 4 · Remedy Scalability. A system is scalable if it remains effective when there is a significant increasein the number of resources and the number of users. Hundreds of students log in at 9 am, so the authentication and file serversmust not become bottlenecks. Replicate or partition the servers and cache files locally, so the cost of addingusers stays about O(n). 1 name + definition + scenario instance + remedy = about one mark
  1. Four empty slots: the shape of a one-mark answer to "list and explain challenges with respect to this example". The scenario is a campus computer lab where users log in at any machine (the 2016 exam question worked in full in 1.10).
  2. Name the challenge. One word, bolded or underlined in your script so the marker finds it.
  3. Define it in one line, using the standard wording if you can.
  4. Give an instance from the scenario. Notice it mentions the lab's own servers and a realistic load spike (everyone logs in at 9 am). A generic sentence about "many users" would not earn this part.
  5. Give a remedy: a named technique (replication, partitioning, caching) that fixes that instance.
  6. Four lines, one mark. Repeat for as many challenges as the question asks for, picking the ones with the clearest instance in the scenario.
Check yourselfWhich challenge is in CDK's list of eight but missing from the lecture slides' summary?
  1. Openness
  2. Transparency
  3. Quality of service
  4. Concurrency

C. Quality of service. The slides list the first seven (heterogeneity, openness, security, scalability, failure handling, concurrency, transparency); CDK adds QoS as the eighth.

Check yourselfA student answers "Scalability: the system must handle lots of users" for a 1-mark part of a scenario question. What is missing?

Almost everything after the name. There is no proper definition (remains effective as users and resources grow significantly), no instance from the scenario (which server, which load spike), and no remedy (replication, caching, partitioning). "Lots of users" is generic, so it earns little of the "with respect to this example" credit.

In short
  • The eight challenges: heterogeneity, openness, security, scalability, failure handling, concurrency, transparency, quality of service (the slides' summary omits QoS).
  • Each comes with a question to ask of a scenario and a standard remedy.
  • For scenario questions: name, define, instance from the scenario, remedy, about one mark per challenge.
1.6

Heterogeneity & Openness

The first two challenges are about difference. Heterogeneity asks how computers that are built differently can work together at all. Openness asks how a system can keep growing when new parts come from different people. They sound alike, and the exam likes to check that you can tell them apart.

Heterogeneity: five aspects

Heterogeneity means variety: the parts of a distributed system differ from each other, yet they must interoperate. CDK lists five aspects in which they can differ. Notice that nearly every solution is either an agreement (protocols, formats, standards) or middleware that hides the difference.

AspectProblemSolution
NetworksEthernet, WiFi, cellular…The Internet protocols mask them
Computer hardwareData representation differs, e.g. byte order (big- vs little-endian)An agreed external data format (Part III)
Operating systemsDifferent APIs to the protocols (UNIX vs Windows)Middleware
Programming languagesDifferent representations of characters, arrays, recordsA common format, middleware
Different developers' implementationsCan't communicate without agreementCommon standards

An API (application programming interface) is the set of functions a program calls to use something, here the operating system's networking. The slides list further aspects of heterogeneity: communication architectures, software interfaces, security measures, and information representation, such as ASCII versus EBCDIC (two different codes for turning characters into numbers, so the same byte means a different letter on each).

The byte-order problem, step by step

Hardware heterogeneity is easiest to see in byte order. A whole number (an int) takes four bytes in memory, and machines disagree about which byte goes first. A little-endian machine stores the least significant byte first; a big-endian machine stores the most significant byte first. Send the raw bytes from one kind to the other and the number changes.

Sending the number 1 from a little-endian to a big-endian machine
SENDER · LITTLE-ENDIAN int x = 1; in memory, low byte first: 01 00 00 00 converts to the agreed external format first RECEIVER · BIG-ENDIAN reads high byte first 01 00 00 00 raw bytes, sent as they are 01 00 00 00 x = 16,777,216 wrong: 0x01000000 00 00 00 01 agreed external format 00 00 00 01 x = 1 converted from the agreed format
  1. The sender, a little-endian machine, holds int x = 1. In memory that is four bytes with the low byte first: 01 00 00 00.
  2. It sends those raw bytes across the network exactly as they sit in memory.
  3. The receiver is big-endian: it reads the first byte as the most significant. 01 00 00 00 means 0x01000000 to it, which is 16,777,216. Same bytes, different number.
  4. The fix is an agreed external data format: both sides agree on one byte order for data on the wire (here, high byte first). The sender converts into it and the receiver converts out of it, so each machine only has to know its own order and the agreed one. Doing this conversion is called marshalling, covered in Part III.

Middleware exam

Definition

Middleware is a software layer that provides a programming abstraction and masks the heterogeneity of the underlying networks, hardware, operating systems and programming languages.

Examples are CORBA, which works across different programming languages, and Java RMI (Remote Method Invocation), which works within a single language, Java. Middleware usually runs over the Internet protocols (which already hide the differences between networks), and on top of them it gives programmers a uniform computational model: one way of thinking about the whole system, such as remote object invocation, remote event notification, remote SQL database access, or distributed transactions. Part IV and Part VI go deeper.

languages middleware operating systems hardware Internet protocols networks Java program C++ program Python program Middleware: one uniform computational model remote objects, remote events, remote SQL, distributed transactions (e.g. CORBA, Java RMI) Windows Linux macOS x86 (little-endian) ARM ARM Internet protocols (TCP/IP): one way to send messages Ethernet WiFi cellular
Wide bands hide the narrow boxes below them. Each column is one host, and every row of small boxes is a point of difference. The two full-width bands are the agreements that hide those differences: the Internet protocols (teal) hide the networks, and middleware (violet) gives every program, whatever its language, OS or hardware, the same model of the system.

Mobile code and the virtual machine approach

Mobile code is code sent from one computer to run on another, such as a Java applet or the JavaScript in a web page. It runs straight into heterogeneity, because a compiled program (an executable) is tied to one instruction set and operating system. The virtual machine approach gets round this. Programs are compiled not for a real processor but for a virtual one (Java bytecode), and the JVM (Java Virtual Machine), the program that runs bytecode, is implemented once per platform. After that, every program runs everywhere.

NATIVE EXECUTABLE app.exe compiled for x86 + Windows Windowsx86 LinuxARM macOSARM runs won't run won't run
Tied to one platform. Machine code only runs on the instruction set and OS it was compiled for.
BYTECODE + ONE JVM PER PLATFORM App.class Java bytecode, compiled once JVM JVM JVM Windowsx86 LinuxARM macOSARM runs runs runs
Write once, run anywhere. The JVM (violet) is ported to each platform once; then any bytecode runs on all of them.
Check yourselfSelf-test Q4: What is middleware? How are heterogeneity and mobile code handled?

Middleware is a software layer that gives a programming abstraction and masks the differences between networks, hardware, operating systems and languages; CORBA and Java RMI are examples. Differences between networks are masked by the Internet protocols. Mobile code has the problem that executables are tied to an instruction set and OS, and the virtual machine approach solves it: the JVM is implemented once per platform, so the same bytecode runs everywhere.

Check yourselfA little-endian client sends a raw 4-byte integer to a big-endian server, which reads a different value. Which aspect of heterogeneity is this, and what is the fix?

Computer hardware heterogeneity: the two machines represent data differently in memory (byte order). The fix is an agreed external data format: both sides convert to and from one agreed representation for data in transit.

Openness exam

Definition

Openness is the characteristic that determines whether a system can be extended and re-implemented in various ways. For a distributed system it mainly means how far new resource-sharing services can be added and used by a variety of clients.

Openness requires the key interfaces to be published: the exact rules for talking to each service are written down where anyone can read them. Publishing often bypasses slow official standardization. The IETF (Internet Engineering Task Force) publishes RFCs ("Requests for Comments"), which specified TCP/IP and then FTP, email and telnet; publishing them is what made the Web possible. The W3C publishes the Web's standards in the same way, and the slides name other bodies too: ANSI, ISO, IEEE and OMG.

published by: IETF RFCs W3C ANSI ISO IEEE OMG Chrome Firefox Python client published interface: HTTP anyone can read the spec web server written in Java new service any vendor, conformance tested plugs in benefits: extensibility, vendor independence, portability, interoperability
The published interface is the socket everything plugs into. Clients from different vendors (blue) all reach a Java server (red) because the interface (gold) is public, and a new service (green, dashed) can be added the same way, once its conformance is tested.

Open distributed systems have three properties:

  1. They publish their key interfaces.
  2. They use a uniform communication mechanism, with published interfaces to shared resources.
  3. They can mix heterogeneous hardware and software from different vendors, but each component's conformance must be tested (checked against the published standard).

The benefits are extensibility at both the hardware and the software level, and vendor independence: you are never locked in to one supplier. Publication is only the start, though; integrating components built by different people is the hard part. The slides add the IEEE POSIX view, in which open specifications for interfaces, services and formats give application portability (a program moves between systems), interoperability (systems work together) and user portability (people's skills move with them). For example, Chrome, Firefox or a Python client can all talk to a server written in Java.

Openness versus heterogeneity

HeterogeneityOpenness
AboutCoping with existing platform differencesAdding or replacing components through published interfaces
QuestionCan these different machines work together?Can this system be extended or re-implemented?
RemedyInternet protocols, middleware, VMs, agreed formatsPublished interfaces, standards, conformance testing
Common mistake

Answering an openness question with "different computers can work together". That is heterogeneity. Openness is about extending the system: new services, new vendors, re-implementations, all through published interfaces.

Check yourselfSelf-test Q10: What is openness, and how does it differ from heterogeneity?

Openness is extensibility and re-implementability: new services can be added and used by many clients. It is achieved by published interfaces (RFCs, W3C), a uniform communication mechanism, and conformance testing, and it gives vendor independence. Heterogeneity is about coping with platform differences, whereas openness is about extending the system through published interfaces.

Check yourselfWhich of these is not one of the three properties of an open distributed system?
  1. Key interfaces are published.
  2. A uniform communication mechanism with published interfaces to shared resources.
  3. All components come from the same vendor, so they are guaranteed compatible.
  4. Heterogeneous components from different vendors can be mixed, with conformance tested.

C. Single-vendor is the opposite of openness; vendor independence is one of its benefits. A, B and D are the three properties.

In short
  • Heterogeneity: networks, hardware (byte order), OSs, languages and implementations differ. Remedies: Internet protocols, agreed data formats, middleware, standards, and virtual machines for mobile code.
  • Middleware is a software layer giving a programming abstraction that masks heterogeneity (CORBA, Java RMI).
  • Openness: can the system be extended and re-implemented? It needs published interfaces, a uniform communication mechanism and conformance testing, and gives vendor independence.
1.7

Security & Scalability exam

The next two challenges are about pressure from outside. Security asks what happens when someone wants the system to misbehave. Scalability asks what happens when far more people want to use it than it was built for. Both come up in nearly every scenario question.

Security: the components

The information resources in a distributed system are valuable, and messages travel over networks that others can see. Security of information resources has three components, plus a fourth that the slides add.

component 1

Confidentiality

Protection against disclosure to unauthorized individuals. Access control lists (ACLs), which list who may use a resource, are one way to provide it.
component 2

Integrity

Protection against alteration or corruption, such as someone changing the amount on a money order.
component 3

Availability

Protection against interference with the means of access, such as a denial-of-service (DoS) attack.
slides add

Non-repudiation

Proof of sending or receiving, so nobody can deny it later. A digital signature provides it.
Confidentiality against disclosure doctor {record}K records Eve: sees only ciphertext remedy: encryption; ACLs for access control Integrity against alteration pay Bob $10 Mallory pay Bob $1000 the message arrives, but it has been changed Availability against interference with access attacker flood of pointless requests genuine user can't get in Non-repudiation slides add customer "I never ordered that!" [order]K_priv held by the shop: proof remedy: a digital signature proves who sent it
Four ways things can go wrong. Attackers are red, legitimate users blue. {M}K means M encrypted with key K; [M]K means M signed with key K (see the diagram key). Confidentiality and integrity protect the data; availability protects access; non-repudiation protects against later denial.

The slides also list the mechanisms used: encryption (scrambling data so only a key-holder can read it, e.g. the Blowfish and RSA algorithms), authentication (proving who someone is, e.g. by password or public key) and authorization (deciding what an authenticated party may do, e.g. with ACLs).

Firewalls are not enough

A firewall guards the boundary of an intranet, so it is tempting to think it solves security. It doesn't, because it doesn't govern how users inside the intranet use resources, nor the use of resources outside it.

INTRANET FIREWALL outside attacker blocked confidential files insider misuse inside user outside service use of resources outside
A wall only stops what crosses it. The firewall (gold) blocks the outside attacker, but it never sees the insider's misuse, and it has no say in how resources beyond the boundary are used. That is why finer-grained security (Part X) is needed.

Encryption meets two challenges. The first is sending sensitive data secretly, such as patient records or credit card numbers. The second is identifying the remote user or agent: is this really a doctor? Is this really my bank? Two problems, however, are not fully solved:

  • Denial of service (DoS). The service is flooded with pointless requests so that genuine users can't get in. It is mostly countered by catching the culprits afterwards rather than by preventing it.
  • Security of mobile code. An email attachment may seem harmless but in fact access local resources or join a DoS attack.

Security is covered in depth in Part X.

Check yourselfSelf-test Q9: Give the security components, and two unsolved challenges.

The components are confidentiality, integrity and availability, and the slides add non-repudiation. Encryption gives secrecy and lets you authenticate the remote party. Two challenges remain unsolved: DoS, and the security of mobile code. Firewalls are not enough, because they don't control insiders.

Check yourselfA customer orders a TV online, then claims they never placed the order. Which security component is at stake, and which mechanism addresses it?
  1. Confidentiality; encryption
  2. Integrity; a checksum
  3. Non-repudiation; a digital signature
  4. Availability; a firewall

C. Denying having sent something is repudiation; a digital signature on the order is proof of sending. This is exactly the bookstore's "a customer denies ordering" case in 1.10.

Scalability: the definition exam

Definition

A system is scalable if it remains effective when there is a significant increase in the number of resources and the number of users. This should hold at any scale, from a small intranet to the whole Internet.

Common pitfall

Scalability is not speed. A fast system can scale badly and a slow one can scale well. Scalability is about the growth rates of cost and performance as the system gets bigger. Ideally, the software doesn't have to change as the scale grows.

The four challenges of scalable design exam

The challenges below use big-O notation: O(n) means "grows in proportion to n", and O(log n) means "grows like the logarithm of n", which is very slowly: doubling n only adds a constant amount.

  1. Controlling the cost of physical resources. The resources needed for n users should grow at most O(n), so the system can be extended at reasonable cost. If 1 file server supports 20 users, then 2 should support 40. The point is to add servers rather than overload one.
  2. Controlling performance loss. For data that grows with the system, access time should grow no worse than O(log n), which means using hierarchic rather than linear structures. The example is the DNS table that maps names to addresses.
  3. Preventing software resources running out. Future demand is hard to predict, but over-provisioning costs too, because oversized fields waste space in every message. The example is 32-bit IPv4 addresses running out, which led to 128-bit IPv6 and much software change. Y2K-like problems (two-digit years) are of the same kind.
  4. Avoiding performance bottlenecks. The answer is decentralized algorithms. DNS's predecessor was one master hosts file that everyone consulted, whereas DNS partitions the table across locally run servers. A popular ("hot") web page, similarly, is handled by caching and replication.
1 · cost of physical resources number of users, n resources needed worse than O(n): too costly O(n): fine 1 server per 20 users 2 · access time as data grows amount of data, n time per lookup linear list: O(n) hierarchy (DNS): O(log n)
Scalability is about the shape of the curve, not its height. Green is what you want: cost that grows no faster than the number of users, and lookup time that barely grows at all, which hierarchic structures give you. The curves are sketches, not measurements.
BEFORE: ONE MASTER HOSTS FILE hosts file every name, one machine everyone queues at one machine: bottleneck
Centralised. Every lookup and every update goes to one place, so it can't keep up as the Internet grows.
AFTER: DNS PARTITIONS THE TABLE root au com org edu.au unimelb.edu.au each box is a server run locally by its owner lookups spread out; O(log n)
Decentralised and hierarchic. The table is split into parts, each run by its own organisation, so the load spreads and lookups follow a short path down a tree (Part IX).
IPv4 32 bits ran out as the Internet grew IPv6 128 bits (CDK; the slides say 64)
Running out of a software resource. IPv4's 32-bit address field was a design decision made when nobody foresaw billions of devices; widening it to IPv6's 128 bits meant changing software everywhere. The slides say "32→64 bit"; CDK, which this site follows, says 128.

Scaling techniques, and a web example

The general techniques for scaling are replication (keeping copies), caching (keeping recently used data close to where it is used), multiple servers sharing common tasks, hierarchy, and partitioning (splitting data or work into parts handled by different servers). The lecturer gives a web example: static web content scales by adding servers and adjusting DNS so the name points at all of them, but dynamic content also needs the back-end database to be replicated and synchronised.

client DNS www.shop.com → 3 IPs web server 1 web server 2 web server 3 static: add servers + adjust DNS replica 1 replica 2 replica 3 keep in sync dynamic: also replicate the DB
Static content is easy; dynamic content drags the database along. DNS (brown) spreads clients over several web servers (red). If pages are generated from a database, every server needs current data, so the database replicas (green) must be synchronised (gold), which is the hard part.
Check yourselfSelf-test Q7: Explain the four challenges of scalable design.
  1. Cost of physical resources. This should grow at most O(n) with the number of users, for example one server for every 20 users.
  2. Performance loss. Access time should grow at most O(log n), which hierarchic structures such as DNS achieve.
  3. Software resources running out. IPv4's 32-bit addresses ran out, which led to IPv6's 128-bit addresses.
  4. Bottlenecks. These are avoided by decentralizing, as when the single hosts file gave way to DNS, and by caching and replicating hot data.
Check yourself"System X is scalable because it answers every request in under 10 ms." What is wrong with this claim?

It confuses speed with scalability. Response time today says nothing about how cost and performance grow when users and resources increase significantly. To show scalability you would argue that resources needed grow at most O(n), access time at most O(log n), no software resource runs out, and there is no central bottleneck.

In short
  • Security = confidentiality, integrity, availability (+ non-repudiation in the slides), via encryption, authentication and authorization. Firewalls aren't enough; DoS and mobile code are not fully solved.
  • Scalable = remains effective as users and resources grow significantly. Four challenges: cost at most O(n), access time at most O(log n), don't run out of software resources (IPv4→IPv6), avoid bottlenecks (decentralize, cache, replicate).
  • Scalability is about growth rates, not raw speed.
1.8

Failures, Concurrency & QoS exam

The next three challenges come straight from the consequences in 1.3. Independent failures become the failure handling challenge; concurrent execution becomes the concurrency challenge; and the timing demands of multimedia become quality of service.

Failure handling: three words to keep apart exam

The slides define three terms that are easy to confuse, and the exam rewards getting them exactly right.

Failure

The service no longer meets its specification: it is unavailable, or too slow to use. A failure is what users observe.

Fault

The cause of a failure, such as a component crash or a broken disk.

Fault tolerance

No failure despite faults: the faults are handled and hidden from users.

no fault tolerance fault: disk crashes the cause failure: misses its spec unavailable or too slow user notices fault tolerance fault: disk crashes the same cause handled: mirror disk used fault masked no failure: notices nothing
Same fault, different outcome. A fault is the cause; a failure is what the user sees. Fault tolerance breaks the chain between them, so a fault happens but no failure follows.

What makes failures hard in a distributed system is that they are partial: some components fail while others continue (the "independent failures" consequence). The system must keep going around the broken parts.

Five techniques for dealing with failures exam

CDK gives five techniques. The slides list only the first four; CDK adds redundancy.

1 · Detect data... sum sum mismatch! checksums catch corruption; a remote crash is only suspected 2 · Mask write retransmit lost msgs; write to two disks; not guaranteed always 3 · Tolerate cannot contact server (not: wait forever) expose the failure in a controlled way; timeouts, exceptions 4 · Recover op 1 done op 2 done op 3 ... roll back to here roll permanent data back to a consistent state, using logs 5 · Redundancy CDK adds R1 R2 second route still works duplicate parts: 2 routes, 2 DNS servers, failover
From noticing to surviving. Detect finds the failure; mask hides it; tolerate admits it gracefully; recover repairs permanent data afterwards; redundancy has spares ready. Only redundancy is missing from the slides' list.
  1. Detecting a failure means noticing it. Checksums (a number computed from the data and sent with it; if the receiver's recomputation differs, the data was corrupted) detect corrupted data, and heartbeats (regular "I'm alive" messages) are another means. A crashed remote server, however, can't be detected, only suspected: as 1.3 showed, silence looks the same whether it is crashed or slow.
  2. Masking hides a detected failure, or makes it less severe. You can retransmit lost messages, write data to two disks, or drop a corrupt message (so it looks merely lost, which retransmission can then fix). Masking is not guaranteed in the worst case: if every retry is lost, or both disks fail, it can't help.
  3. Tolerating a failure means exposing it to the client or user in a controlled way. A browser that reports "cannot contact server" instead of waiting forever is tolerating the failure; timeouts and exceptions are the usual tools.
  4. Recovery means rolling back permanent data to a consistent state after a crash, using rollback and logs (a log records each change so it can be undone or redone).
  5. Redundancy means duplicating components: at least two routes between any two routers, each DNS table held on at least two servers, or a replicated database with client failover (clients switch to a replica when the main copy fails). Its difficulty is keeping replicas of fast-changing data up to date.
Redundancy in action: failing over to a replica
time client primary DB replica DB copies kept up to date 1 · query 2 · result primary crashes 3 · query timeout: suspect the primary 4 · query again (failover) 5 · result
  1. A client uses a primary database. A replica on another machine is kept up to date from the primary: this duplication is the redundancy.
  2. Normal operation: the client's query goes to the primary, which replies.
  3. The primary crashes. Thanks to independent failures, the replica and the client keep running.
  4. The client's next query gets no reply. After a timeout it suspects the primary has failed. (It can't be sure; it might just be slow.)
  5. The client fails over: it sends the query to the replica, which answers. The user sees, at worst, a short delay.
  6. The catch, highlighted: failover only helps if the replica's data is current. Keeping replicas of fast-changing data up to date is the difficulty CDK names for redundancy.

Availability

Definition

Availability is the proportion of time a system is available for use.

A distributed system can achieve high availability precisely because failures are independent: a failure only affects the work that uses the failed component, so users or servers can move to other computers. One crashed PC in a lab doesn't stop anyone else.

Common pitfalls
  • A fault is the cause; a failure is the observable deviation from the specification. Don't swap them.
  • Masking hides a failure (retransmission); tolerating exposes it gracefully (an error message). They are opposites, not synonyms.
Check yourselfSelf-test Q8: Define fault, failure and fault tolerance, and list the failure-handling techniques.

A fault is the cause, and a failure is a deviation from the specification; fault tolerance means there is no failure despite faults. The techniques are:

  1. Detecting failures, for example with checksums, although a remote crash can only be suspected.
  2. Masking them, for example by retransmission or mirrored disks.
  3. Tolerating them, by reporting the error or using timeouts.
  4. Recovering from them, by rollback.
  5. Redundancy, such as two routes, or replicated DNS and databases with failover.

Availability is the proportion of time the system is usable.

Check yourselfAn email client can't reach its server and shows "Server unavailable, will retry in 5 minutes". Which technique is this?
  1. Detecting
  2. Masking
  3. Tolerating
  4. Recovery

C. Tolerating. The failure is exposed to the user in a controlled way rather than hidden (masking) or left to hang. If the client had silently retried until it worked, never showing anything, that would be masking.

Concurrency

Several clients may access a shared resource at the same time; in an online auction, for instance, bids pile up near the deadline. A server can't sidestep this by serving one request at a time, because that limits throughput (the number of requests handled per second). So servers process requests concurrently, typically in threads (several sequences of execution running inside one process and sharing its memory; Part IV). But uncontrolled interleaving corrupts data: when two threads' steps mix in an unlucky order, the result can be something neither intended. In CDK's example, concurrent bids "Smith: $122" and "Jones: $111" end up stored as Smith: $111, Jones: $122. The stepper shows one way that can happen.

Two bids, interleaved: how Smith ends up with Jones's amount
thread 1: Smith bids $122 thread 2: Jones bids $111 1 · bidders.add("Smith") 2 · bidders.add("Jones") 3 · amounts.add(111) 4 · amounts.add(122) SHARED BID LIST (IN THE SERVER) bidders [0][1] amounts [0][1] Smith Jones 111 122 read back by position: Smith: $111, Jones: $122 each stored bid is half one thread's, half the other's
  1. The server keeps a shared bid list as two parallel lists, bidders and amounts; position [i] in each belongs to the same bid. Recording a bid takes two steps, and two threads are about to do it at once.
  2. Thread 1 adds "Smith" to bidders, at position [0]. Then the scheduler pauses it, which can happen between any two steps.
  3. Thread 2 runs and adds "Jones" at bidders[1].
  4. Thread 2 carries on and adds its amount, 111, which lands at amounts[0], the first free slot.
  5. Thread 1 resumes and adds 122, which lands at amounts[1].
  6. Reading the list by position pairs Smith with $111 and Jones with $122. Each thread's code was correct on its own; the interleaving corrupted the data. (This is an illustration of how CDK's outcome can arise; the fix is to make each bid's two steps one indivisible operation.)
The rule exam

Every object that represents a shared resource must be responsible for being safe in a concurrent environment. It achieves this by synchronizing its operations, with semaphores, locks or Java's synchronized, so that its data stays consistent.

A lock is a token only one thread can hold at a time; a thread that wants it while another holds it must wait. A semaphore is a counter-based generalisation of a lock. In Java, marking a method synchronized means a thread must hold the object's built-in lock to run it. Here is the auction item written as a safe shared object, exactly as in the study guide:

// Shared auction item, safe for concurrent client threads (threads: see §4)
public class AuctionItem {
    private String bidder = "none";
    private int amount = 0;

    // synchronized: one thread at a time per object, so (bidder, amount) change together
    public synchronized boolean bid(String who, int value) {
        if (value <= amount) return false;   // reject bids that are not higher
        bidder = who;
        amount = value;
        return true;
    }

    public synchronized String leader() {     // consistent read of both fields
        return bidder + ": $" + amount;
    }
}

Reading it line by line:

  • The two private fields, bidder and amount, are the shared state. Because they are private, the only way to touch them is through the two methods, which are both synchronized.
  • bid is synchronized, so while one thread is inside it no other thread can enter bid or leader on the same object. The check (value <= amount) and the two assignments therefore happen as one indivisible unit: nobody can sneak in between setting bidder and setting amount, which is exactly the gap the stepper above exploited.
  • The check also enforces the auction's rule: a bid that isn't higher than the current one is rejected (return false).
  • leader is synchronized too. Without that, a reader could see the new bidder with the old amount halfway through someone else's bid. Synchronizing the read gives a consistent snapshot of both fields.
thread 2 wants bid(): must wait AUCTIONITEM OBJECT one lock per object thread 1 inside bid() holds the lock until it returns bidder = "Smith" amount = 122 both fields change together
One thread inside at a time. While thread 1 (blue) holds the object's lock (gold), thread 2 (brown) waits at the door. The two fields are always updated as a pair, so no interleaving can split a bid.

The slides add three further requirements for concurrency:

  • Scheduling must be fair: no waiting client should be starved forever.
  • Dependencies must be preserved. In a distributed transaction, for instance, the buyer's funds must be checked before the order is finalized.
  • Deadlock must be avoided: the situation where two parties each hold a resource the other is waiting for, so neither can ever proceed.
resource R1 resource R2 P1 P2 held by waits for held by waits for a cycle: nobody can proceed
Deadlock is a cycle of waiting. Follow the arrows: P1 waits for R2, held by P2, which waits for R1, held by P1. Every party is waiting on another, forever.
Check yourselfSelf-test Q11: How should a shared object deal with concurrent requests?

Processing requests serially limits throughput, but uncontrolled interleaving corrupts data, as with the swapped Smith/Jones bids. The object should therefore synchronize its operations, using locks, semaphores or synchronized. It should also schedule fairly, preserve dependencies with transactions, and avoid deadlock.

Check yourselfIn AuctionItem, why is leader() synchronized when it only reads?

So the read is consistent. If it weren't synchronized, it could run while another thread is halfway through bid(), after bidder has changed but before amount has, and report a winner with the wrong amount. Synchronizing it means it can only run when no bid() is in progress on that object.

Quality of service

Quality of service (QoS) is the eighth challenge, the one CDK lists and the slides' summary leaves out. It concerns a system's non-functional properties, meaning not what it does but how well: reliability, security and performance, plus adaptability to changing configurations.

Performance here has a specific meaning: the ability to meet timeliness guarantees. A stream of video frames, for example, must be shown within time limits; a frame that arrives late is as bad as one that never arrives. Meeting such deadlines needs guaranteed computing and network resources. Applications reserve the resources they need, resource managers provide the guarantees, and reservations that can't be met are rejected. This applies to the operating system (CPU time, memory) as well as to the network. Ordinary networks perform well, but they give no guarantees under heavy load.

Continuous media: every frame has a deadline deadline 1deadline 2 deadline 3deadline 4 deadline 5deadline 6 f1 f2 f3 f4 late: glitch f5 f6 Reservation: guarantees, or a clear "no" app A: reserve app B: reserve app C: reserve resource manager CPU, network bandwidth accepted accepted rejected: can't be met guaranteed capacity A's share B's share free C needs more than is free, so it is refused
Timeliness needs reservations. A late frame (f4) is a failure for video even though it arrived. To prevent that, applications reserve capacity in advance; a resource manager (violet) grants reservations it can honour and rejects the rest, rather than letting everyone slow down together. The shares are illustrative.
Check yourselfWhich four properties does QoS cover, and what does "performance" mean in that context?

QoS covers the non-functional properties reliability, security and performance, plus adaptability to changing configurations. Performance means the ability to meet timeliness guarantees (e.g. video frames shown within time limits), which requires guaranteed resources: applications reserve, resource managers guarantee, and unmeetable reservations are rejected.

In short
  • Fault = cause; failure = service misses its spec; fault tolerance = no failure despite faults. Failures are partial. Techniques: detect, mask, tolerate, recover (slides) + redundancy (CDK). Availability = proportion of time usable.
  • Concurrency: serving one request at a time limits throughput, but uncontrolled interleaving corrupts data, so every shared object synchronizes its operations; also fair scheduling, preserved dependencies, no deadlock.
  • QoS: reliability, security, performance (timeliness guarantees) and adaptability, achieved by reserving resources.
1.9

Transparency exam: most examined

Tanenbaum's definition said a distributed system should appear to its users as a single computer. Transparency is the name for achieving that: hiding the fact that the system is made of separate parts. It is the most heavily examined idea in this Part, usually as "list and explain the transparencies" or "which transparency does this example show?"

Definition

Transparency is the concealment from the user and the application programmer of the separation of components in a distributed system, so that the system is perceived as a whole rather than as a collection of independent components.

"Transparent" here means "invisible", as in a clear pane of glass: you look straight through the machinery without noticing it. The eight forms below come from two standards, ANSA (the Advanced Networked Systems Architecture) and ISO RM-ODP (the Reference Model for Open Distributed Processing), although CDK replaces their migration transparency with the broader mobility transparency. For each one, know what it enables and an example.

A memory hook

Four of the eight are about what is hidden from you: where it is (location), how you reach it (access), how many copies there are (replication), and whether it moved (mobility). Two are about trouble: other users (concurrency) and breakdowns (failure). The last two are about growth: reconfiguring under load (performance) and getting bigger (scaling).

The eight transparencies, one picture each

Access transparency enables local and remote resources to be accessed using identical operations. A mounted NFS directory (a remote file system attached so it appears as part of your own; Part VIII) or a Dropbox folder is used exactly like a local one. Having to use a separate tool such as ftp for remote files shows what life is like without access transparency.

your program calls read() for both local disk read(notes.txt) NETWORK NFS server read(report.txt) without it: a different tool for remote files, e.g. "ftp get report.txt"
Same operation, local or remote. The program can't tell from the call which file is on another machine.

Location transparency enables resources to be accessed without knowledge of their physical or network location, such as which building they are in or their IP address. You use URLs and domain names rather than IP addresses, and DNS (the Domain Name System, which translates names into addresses; Part IX) follows a server whose IP address changes.

user www.unimelb.edu.au DNS name → address SOMEWHERE 203.0.113.5 building ? hidden from the user: the address and the place all the user knows: a name
Names, not places. The user's world stops at the name; everything right of the DNS box is invisible to them. The IP address shown is an example.

Concurrency transparency enables several processes to operate concurrently using shared resources without interference between them. Two customers ordering the last copy of a book each see a consistent result: one gets the book, the other is told it is sold out, and neither sees a corrupted state.

customer 1 customer 2 order last copy order last copy bookstore one order at a time, behind the scenes customer 1: ordered customer 2: sold out
Sharing without noticing each other. Each customer sees a sensible answer; the coordination that produced it is hidden.

Replication transparency enables multiple instances of a resource to be used, for reliability and performance, without users or application programmers knowing of the replicas. google.com, for example, is served by many hosts, but you type one name.

user google.com BEHIND THE NAME: MANY REPLICAS replica 1 replica 2 replica 3 identical copies
Many copies, one appearance. The user's request lands on one replica (green), and they neither know nor care which.

Failure transparency enables the concealment of faults, so users and application programs can complete their tasks despite the failure of hardware or software components. Email is retransmitted until it is delivered, even if a mail server is down for a while; and when one node of a replicated website fails, the site stays up.

Alice Alice's mail server Bob's mail server try 1: down wait, retry (for days if need be) try 2: ok Bob Alice and Bob never see the failed attempt
The fault happens; nobody sees it. Retrying hides a temporarily failed server from both users.

Mobility (migration) transparency allows the movement of resources and clients within a system without affecting the operation of users or programs. Examples: a mobile phone call carries on while both phones move between cells (the areas covered by different towers); a client switches to a different name server at run time; a running process migrates to another machine.

CELL A CELL B tower A tower B moves mid-call the call is handed over and carries on
Things move; nothing breaks. The phone (blue) changes cells, but the person on the call notices nothing.

Performance transparency allows the system to be reconfigured to improve performance as loads vary, for example by adding servers dynamically or moving from linear to hierarchical structures, without users noticing the change.

LIGHT LOAD 2 servers load rises: reconfigure HEAVY LOAD added 3 servers, same service
Reconfiguring under load. The system adapts its configuration to the load it is under; users just see a service that stays responsive.

Scaling transparency allows the system and its applications to expand in scale without changing the system structure or the application algorithms, as when more servers are put behind the same name and the clients are unchanged.

connect("shop.com") client code: never changes shop.com server 1 (original) server 2 (new) server 3 (new) server 4 (new) same structure
Grow without rewriting. New servers (violet) join behind the same name; the client's code and the system's structure stay exactly as they were.
TransparencyEnables…Example
Accesslocal and remote resources accessed with identical operationsNFS mount, Dropbox folder (not: ftp)
Locationaccess without knowing physical or network locationURLs and domain names; DNS follows an IP change
Concurrencyshared use without interferencetwo customers ordering the last book
Replicationmultiple instances used without anyone knowing of the replicasgoogle.com on many hosts
Failurefaults concealed; tasks complete anywayemail retried until delivered; site survives a node failing
Mobilityresources and clients move without affecting users or programsa call continuing across cells; process migration
Performancereconfiguration to improve performance as loads varyadding servers dynamically
Scalinggrowth without changing structure or algorithmsmore servers behind the same name, clients unchanged
Check yourselfSelf-test Q5: List and define the eight transparencies, with examples.
  1. Access transparency means local and remote resources are used with the same operations, as with an NFS mount.
  2. Location transparency means resources are used without knowing where they are, as with URLs and DNS.
  3. Concurrency transparency means processes share resources without interference, so two customers ordering the last book do not disrupt each other.
  4. Replication transparency means replicas are used without users knowing of them, as with the google.com replicas.
  5. Failure transparency means faults are concealed, as when email retries until it is delivered.
  6. Mobility transparency means resources and clients can move without affecting users, as when a call continues across cells.
  7. Performance transparency means the system can be reconfigured under load.
  8. Scaling transparency means the system can grow without changing its structure or algorithms.
Check yourselfEd practice quiz: a user is served by one of forty machines on three continents without knowing which. Which property is this?

Transparency, specifically location transparency (they don't know where the machine is) and replication transparency (they don't know there are forty copies).

Check yourselfMatch each example to its transparency: (a) your laptop opens a file in a mounted network drive with the usual Open dialog; (b) a video-call app keeps the call going as you walk from WiFi onto mobile data; (c) a shop's site adds servers at Christmas and nobody's app needs updating.

(a) Access: identical operations for local and remote files. (b) Mobility: the client moves without affecting the call. (c) Scaling (growth without changing structure or client code); if the servers are added and removed automatically as load varies, that is also performance transparency.

Network transparency exam

Definition

Network transparency means access and location transparency together. These are the two that most affect how usable distributed resources are.

access same operations + location no need to know where = network transparency alice@unimelb.edu.au used the same way for anyone (access); works without knowing where Alice is (location) and email also retries for days: failure transparency too
Two of the eight, not all eight. Network transparency is precisely access plus location. An email address is the classic example of both.
Common pitfall

Network transparency is access and location transparency only, not all eight. And keep location and mobility apart: location transparency means you needn't know where a resource is; mobility transparency means it can move without disturbing you. URLs give the first but not the second.

Are URLs transparent?

A URL such as http://www.a.com/page.html names a server by its DNS name, not its IP address, so it is location-transparent: the server can change address and DNS will follow. But it is not mobility-transparent: move the page to another domain, and every link to the old URL breaks. The stepper shows both.

One link, two kinds of move
BROWSER a saved link: http://www.a.com/page.html 200 OK: page loads 200 OK: still works 404: dangling link DNS www.a.com → 203.0.113.5 www.a.com → 198.51.100.7record updated server www.a.com IP 203.0.113.5 IP 198.51.100.7 (moved) has page.html page.html is gone server www.b.com now has page.html 1 2 · GET /page.html location transparent: the link holds a name, not an IP not mobility transparent: the link names the old domain
  1. A browser holds a link, http://www.a.com/page.html. DNS maps www.a.com to the server's current IP address (the addresses here are examples).
  2. The user clicks: 1, the browser asks DNS for the address; 2, it sends GET /page.html to that address. The page loads.
  3. The server moves to a new IP address. The DNS record is updated, the same link resolves to the new address, and the page still loads. Because the link holds a name rather than an address, this move is invisible: location transparency.
  4. Now the page itself moves to another domain, www.b.com. The old link still says www.a.com, which no longer has the page: 404 Not Found. Every link to it is now a dangling link, so URLs are not mobility-transparent.

Replication and URLs: two views that both hold

Replication and URLs need more care. CDK says identifiers containing domain names prevent full replication transparency: DNS can map one name to several hosts, but each lookup returns only one, so a replication scheme that wants to use all its replicas must name each one separately. The lecturer, on the other hand, cites DNS mapping a name to many hosts as an example of replication transparency from the user's view, because the user types one name and is served by some replica. Both points hold: they are looking at the system from different sides.

user look up www.google.com DNS www.google.com → host A host B host C answer: host A only lecturer: replication transparency from the user's view: one name, served by some replica CDK: not full replication transparency a lookup returns only one host, so a scheme that uses all replicas must name each one both statements are true; they describe different viewpoints
Same mechanism, two verdicts. To the user, one name hiding many hosts is replication transparency (green). To a system designer who needs every replica, a name that yields one host is a limitation (gold).

When transparency fails, or isn't wanted

Transparency has limits. Middleware can't make a network failure vanish completely; what it does is turn network and process failures into exceptions that the program must handle, a controlled exposure (the "tolerate" technique from 1.8).

And transparency isn't always wanted. A location-aware user wants to know where things are: they want the nearest printer, not any printer, or the local mail server. Hiding location would be unhelpful there.

BUILDING 1 (FAR) printer BUILDING 2 (YOU ARE HERE) printer nearest any printer? no thanks
Sometimes location matters. A user who wants the nearest printer or the local mail server needs the system to reveal location, not hide it.

Two extra transparencies from the slides

The slides add two application-level transparencies that are not among CDK's eight. Persistence transparency masks the deactivation and reactivation of objects (an object can be saved to disk and brought back without its users noticing). Transaction transparency hides the coordination needed to make a group of operations happen all together or not at all.

Check yourselfSelf-test Q6: What is network transparency? Is an HTTP URL location-transparent? Mobility-transparent?

Network transparency is access and location transparency together, as with an email address. An HTTP URL is location-transparent, because it uses a DNS name rather than an IP address. It is not mobility-transparent, though, because moving a page to a new domain breaks the links to it.

Check yourselfNetwork transparency consists of…
  1. all eight transparencies
  2. access and location transparency
  3. location and mobility transparency
  4. access, location and failure transparency

B. Exactly two: access and location. C confuses location with mobility; D adds failure, which email happens to show too but which is not part of the definition.

In short
  • Transparency hides the separation of components so the system is perceived as a whole. Eight forms: access, location, concurrency, replication, failure, mobility, performance, scaling.
  • Network transparency = access + location. URLs are location- but not mobility-transparent.
  • On replication, CDK (names return one host, so not full) and the lecturer (user's view) are both right. Transparency isn't always wanted (nearest printer). The slides add persistence and transaction transparency.
1.10

Worked Scenarios exam: scenario

Knowing the eight challenges is half the job; the other half is spotting them in a scenario you have never seen, which is how the exam asks. This section works through two scenarios in full: the lecture's online bookstore, and the computer-lab question from the 2016 final exam.

The online bookstore (from the slides)

The slides apply the challenges to one scenario: customers connect to your web server to browse and order books. Each challenge is introduced by a "what if…?" question, which names the challenge it raises and leads to a remedy. That is exactly the pattern to follow in an exam answer. The numbered badges in the picture match the rows of the table.

Windows PC phone Linux laptop customers 1 bookstore.com 2 Internet sniffing? YOUR BOOKSTORE FIREWALL 5 load balancer web server web server web server 6 inventory DB 3 replica 4 off-the-shelf stack LAMP / J2EE 7
Seven "what ifs", seven places. Customers blue, web servers red, data green, the load balancer violet; red is an attacker. Read each badge against the table below.
#What if…ChallengeRemedy
1Customers use different hardware, OS or data codes (ASCII/EBCDIC)HeterogeneityStandard protocols (TCP/IP, HTTP), middleware, agreed data formats
2You, or a customer, move to the CaribbeanDistribution transparency (location, mobility)DNS names, links; caching and load balancing for a consistent experience
3Two customers order the last copy at onceConcurrencyLocks, transactions
4The inventory DB crashes, or the customer's PC crashes mid-orderFault toleranceReplicated or fail-over servers, transactions with rollback
5A break-in, sniffing, or a customer denies orderingSecurityFirewall, encryption, digital signatures (non-repudiation)
6Millions of simultaneous visitorsScalabilityCommodity servers, load balancing, replication, caching
7Write everything yourself? What about updates?Openness / reuseOpen standards, APIs, off-the-shelf stacks (LAMP, J2EE)

A few terms from the table: a load balancer spreads incoming requests across several servers; a transaction is a group of operations that either all happen or none do, so a crash mid-order can be rolled back; and LAMP (Linux, Apache, MySQL, PHP) and J2EE (Java's enterprise platform) are ready-made software stacks built on open standards.

The computer lab: 2016 final exam, Q1(a) past exam, 5 marks

Past exam 2016 Q1(a) · 5 marks

Consider a large computer lab on a university campus. Users log in to any computer with a username and password, and get software and resources specific to that user. List and briefly explain, with respect to this example, five challenges of distributed systems.

CAMPUS COMPUTER LAB Windows Linux macOS Linux Windows macOS 1 student any PC 9 am: hundreds of logins at once all hit the same servers 4 authentication server auth replica 3 file server home directories file replica 2 5 5 your files look the same at every PC wherever you sit, whichever server answers
Five challenges, five places. Lab PCs are blue, the authentication server brown, the file server red; gold dashes keep replicas in step. The badges match the numbered answer below.
Model answer (study guide)

Each challenge earns one mark, for a definition plus its application to the lab.

  1. Heterogeneity. The lab machines may differ in hardware and OS (Windows, Linux, macOS) and in network type, yet all of them must use the same authentication and file servers and present the same user environment. The remedy is standard protocols and middleware.
  2. Transparency. A user's files and settings must look the same at any machine. This needs access transparency, since the remote home directory is used like a local disk; location transparency, since the user doesn't know which server holds the files; mobility transparency, since the user can move between machines; and failure transparency, since the user doesn't notice a backup server taking over.
  3. Security. Passwords must not cross the network in clear text, so encryption and authentication are needed. Users must reach only their own files and licensed software, which is a matter of confidentiality and access control. And the login server must stay available, which means protecting it against DoS.
  4. Scalability. Hundreds of students log in at 9 am, so the authentication and file servers must not become bottlenecks. The remedy is to replicate or partition the servers and cache files locally. The cost of adding users should be about O(n).
  5. Failure handling. If the file or authentication server fails, nobody can log in, so redundant replicated servers with failover are used. If one PC crashes, the user moves to another PC and loses no data, because failures are independent and the data is stored on the server.

Alternatives. Two other challenges could be used instead. Under concurrency, the same user logged in on two PCs, or a shared file being edited at once, needs locking, and the servers must handle many simultaneous logins. Under openness, new machines or software packages are added through standard published interfaces.

Why this answer scores

Every point names the challenge, says what it means, and then points at something in the lab: the mixed OSs, the home directory, the password crossing the network, the 9 am rush, the crashed PC. A list of textbook definitions with no lab in it would earn far less. Notice too that "transparency" is broken into the specific kinds that apply, which shows you know there are several.

Check yourselfPractice: a university library runs an online catalogue used from three campuses; students search it and place holds on books. Give three challenges with respect to this example, using the four-step recipe.

One possible answer (other well-applied challenges are equally valid):

  1. Concurrency: shared resources must be used concurrently without interference. Two students may place a hold on the last available copy at the same moment, so the hold operation must be synchronized (a lock or a transaction) so that only one succeeds and the other sees a consistent "unavailable".
  2. Failure handling: the service should keep working despite faults. If the catalogue server at one campus crashes, students there should fail over to a replica; the crash is suspected by timeout, and a hold half-recorded during the crash is rolled back.
  3. Transparency (location and replication): users shouldn't need to know where the catalogue runs or how many copies there are. Students on every campus use one name for the catalogue, and DNS or a load balancer picks a replica for them.
Check yourselfIn the bookstore, "a customer denies having ordered" is filed under security. Which component, and which mechanism?

Non-repudiation (the slides' fourth security component), provided by a digital signature on the order, which proves who sent it.

In short
  • Turn each challenge into a "what if…?" about the scenario, then give the remedy: that is the slides' bookstore pattern.
  • For the 2016 lab question, one mark per challenge: heterogeneity (mixed OSs), transparency (access, location, mobility, failure for home directories), security (passwords, access control, DoS), scalability (9 am rush), failure handling (replicated servers, independent PC failures).
1.11

Case Study: the World Wide Web

The Web is the distributed system everyone has used, which makes it a good place to see the ideas of this Part working together: resource sharing, client and server roles, openness, and the limits of transparency. CDK treats it briefly, and so does the exam.

What the Web is

The Web is a system for publishing and accessing resources and services over the Internet. It is open in two ways. First, its standards are freely published, so any browser that conforms to them works with any conforming server. Second, it can be extended with new content types (via browser plug-ins) and new URL schemes. It rests on three components.

browser interprets the HTML web server states the content type HTTP request: GET + the URL's path HTTP reply: HTML document (text/html) HTML what a page contains: content, layout, links URL which resource, on which server HTTP how browser and server talk (request-reply)
Three technologies, three jobs. The URL says what to fetch, HTTP says how to ask for it, and HTML is what comes back. Only the browser interprets HTML; the server just labels it.

1. HTML

HTML (HyperText Markup Language) specifies a page's content, its layout and its links to other resources, written like <A HREF="url">text</A>. Only the browser interprets HTML; the server just states the content type of what it sends.

2. URLs

URLs (Uniform Resource Locators, a kind of URI, Uniform Resource Identifier) identify resources. They take the general form scheme:scheme-specific-identifier, with schemes such as http:, mailto: and ftp:. An HTTP URL has the form http://servername[:port][/pathName][?query][#fragment] (square brackets mark optional parts). It identifies both the server, by its DNS name (the default port is 80), and the resource on that server.

http://servername[:port][/pathName][?query][#fragment] http: //www.w3.org /standards/faq.html #conformance scheme server (port 80) path fragment a part of a page: the "conformance" section http: //www.google.com /search ?q=obama scheme server path: a program query the path names a program, which runs on the query and http://www.cdk5.net alone (no path) gives the server's default page
Reading a URL left to right. The scheme says which protocol, the server part is a DNS name (so the URL is location-transparent), and the rest identifies the resource on that server. In the second URL the path is a program, and the query is its input.

3. HTTP

HTTP (HyperText Transfer Protocol) is the protocol between browsers and servers. Its main features:

  • It is a request-reply protocol: the browser sends a request, the server sends back one reply. GET retrieves a resource, and POST supplies data to the server (e.g. a filled-in form). Errors come back as status codes, such as 404 (not found).
  • It labels content with MIME content types such as text/html or image/gif, so the browser knows how to handle what arrives; the browser states which types it prefers.
  • It fetches one resource per request, so a page with 9 images takes 10 requests (one for the page, one per image). That is why browsers make requests concurrently.
  • It provides simple access control by a password challenge.

The stepper traces a browser fetching a page with one embedded image, the example from CDK.

Fetching a web page with one image, message by message
time Browser DNS Web serverwww.cdk5.net 1 · resolve www.cdk5.net 2 · IP address 3 · GET /WebExample/earth.html 4 · 200 OK, Content-Type text/html parse the HTML, find anembedded image 5 · GET /WebExample/Images/earth.jpg 6 · 200 OK, Content-Type image/jpeg one page + one image = two HTTP requests (one resource per request)
  1. Three participants: the Browser, DNS, and the web server named www.cdk5.net. The user has asked for http://www.cdk5.net/WebExample/earth.html.
  2. The URL contains a DNS name, not an address, so the browser first asks DNS to resolve www.cdk5.net.
  3. DNS replies with the server's IP address. (This is location transparency at work.)
  4. The browser sends an HTTP request, GET /WebExample/earth.html, to that address. The path is the part of the URL after the server name.
  5. The server replies 200 OK (success) and labels the content text/html, its MIME type.
  6. The browser, the only party that interprets HTML, parses the page and finds an embedded image it doesn't yet have.
  7. Because HTTP fetches one resource per request, it sends a second request, GET /WebExample/Images/earth.jpg.
  8. The server replies 200 OK with type image/jpeg. One page with one image took two requests; a page with 9 images would take 10, which is why browsers fetch in parallel.

Dynamic pages, downloaded code and web services

Dynamic pages. Here the URL names a server program (in CDK's terms a CGI program, from the Common Gateway Interface), not a file. The program generates HTML from the query string (with GET) or from the request body (with POST), often by consulting a database. The browser can't tell the result from static content: either way, HTML arrives.

STATIC PAGE browser GET /earth.html HTML web server reads earth.html (a file) DYNAMIC PAGE browser GET /search?q=obama HTML web server runs CGI program generates HTML queries database the browser can't tell the difference: either way, HTML comes back
Same reply, different origin. A static page is a stored file; a dynamic page is built on demand by a program (violet), often from a database. From the browser's side the two are indistinguishable.

Downloaded code is mobile code (1.6) on the Web. JavaScript validates input and updates parts of a page, asynchronously in the case of AJAX (the page fetches data in the background without reloading). Applets are downloaded Java programs.

Web services. HTML is tied to presentation (how a page looks), which makes it unsuitable for programs talking to programs. XML, by contrast, is self-describing structured data. In the REST style, every resource has a URL and accepts the same small set of operations: GET, POST, PUT, DELETE.

The Web's problems

no mobility transparency

Dangling links

Move a resource and the links to it break, because URLs name the server's domain (the stepper in 1.9).
navigation

Lost in hyperspace

Following link after link, users can lose track of where they are and how they got there.
scalability

Scale

Handled by caching in browsers and proxies, and by server clusters (Part II).
Check yourselfSelf-test Q13: Name the Web's three technologies. How does a dynamic page differ from a static one?

The three technologies are HTML, which gives content and links; URLs, which give the server's DNS name, path, query and fragment; and HTTP, a request-reply protocol with GET and POST, MIME types, and one resource per request. A dynamic page is generated by a server program (CGI) from the query or POST data, often using a database, but the browser sees no difference from a static one.

Check yourselfA page contains 4 images and nothing else embedded. How many HTTP requests does the browser make to display it, and why?
  1. 1
  2. 4
  3. 5
  4. It depends on the MIME type

C. 5. HTTP fetches one resource per request: one request for the page, then one for each of the 4 images.

Check yourselfTake apart http://www.w3.org/standards/faq.html#conformance.

Scheme http; server www.w3.org (a DNS name; no port given, so the default 80); path standards/faq.html; fragment conformance, a part within the page. There is no query.

In short
  • The Web publishes and accesses resources over the Internet, and is open (published standards, extensible content types and schemes).
  • HTML = content and links (only the browser interprets it); URL = scheme + server DNS name (port 80) + path, query, fragment; HTTP = request-reply, GET/POST, MIME types, one resource per request, simple password access control.
  • Dynamic pages come from server programs (CGI); REST gives every resource a URL and GET, POST, PUT, DELETE. Problems: dangling links, lost in hyperspace, scale.
1.12

Pitfalls & Tutorial 1 exam

This last section pulls the Part together: one picture of how the ideas connect, the mistakes that most often cost marks, and the official Tutorial 1 answers, whose wording is the closest thing you have to what markers expect.

1.1 Definition components cooperate only by messages 1.3 Consequences concurrency no global clock independent failures (+ heterogeneity) 1.5 – 1.8 8 challenges heterogeneity, openness, security, scalability, failures, concurrency, transparency, QoS 1.9 Transparency access, location, concurrency, replication, failure, mobility, performance, scaling 1.10 Apply it name, define, instance from the scenario, remedy cause → problems → the named design challenges → the star challenge → how the exam asks about them
The whole Part on one line. "Only by messages" causes the consequences; the consequences become design challenges; transparency is the most examined of them; and scenario questions ask you to apply them.

Common pitfalls

Mistakes that lose marks
  • A fault is the cause; a failure is the observable deviation from the specification.
  • Location transparency means you needn't know where a resource is, while mobility transparency means it can move without disturbing you. URLs give the first, not the second.
  • Network transparency is access and location transparency only, not all eight.
  • Masking hides a failure, as retransmission does. Tolerating exposes it gracefully, as an error message does.
  • Scalability is about growth rates of cost and performance, not raw speed.
  • Openness is about extending through published interfaces; heterogeneity is about coping with existing differences.
  • In scenario questions, a definition without an instance from the scenario earns little.

Tutorial 1 (Week 2): official answers official

These are the tutors' official answers from Ed, Tutorial 01, condensed. Staff confirmed tutorial content is examinable, and this wording is the closest thing to what markers expect, so reuse it.

T1-1Provide a definition of a distributed system.

Give both definitions. According to Coulouris, it is a system in which hardware or software components located at networked computers communicate and coordinate their actions only by passing messages. According to Tanenbaum, it is a collection of independent computers that appears to its users as a single coherent system.

T1-2Briefly explain the difference between a computer network and a distributed system.

A computer network is a collection of spatially separated, interconnected computers that exchange messages based on specific protocols. Computers are addressed by IP addresses, so they are visible to users. A distributed system, by contrast, is multiple computers on the network working together as one system. The spatial separation of the computers and the communication between them are hidden from users. The contrast to draw is therefore visibility versus transparency. For a full answer, add that every distributed system relies on the services of a network.

T1-3List three reasons for using a distributed system.

Any three of: economy (cost-effective), reliability (fault tolerance), availability (high uptime), scalability (extendible), and functional separation (modularity). The overall motivation is resource sharing, whether of hardware (disks, printers, scanners), software (files, databases) or other resources (processing power, memory, bandwidth).

T1-4Briefly explain four consequences of using distributed systems.

The four are concurrency, heterogeneity, no global clock, and independent failures (1.3). CDK lists only three; heterogeneity is the slides' addition, and a question asking for four expects heterogeneity as the fourth.

Ed practice quiz (Week 2)

Ed doesn't show the answers to its practice quiz, so the answers below are worked out from the course material rather than official. Items 3–5 also appear earlier in this Part, next to the idea they test.

Ed quiz 1According to Coulouris, components coordinate their actions…

Only by passing messages.

Ed quiz 2Tanenbaum's definition emphasises that a distributed system…

Is a collection of independent computers that appears to its users as a single coherent system.

Ed quiz 3–5(a) Served by one of forty machines on three continents without knowing which? (b) Is a browser talking to one web server over HTTP a DS? (c) A logs 10:00:05, B logs 10:00:03: what can you conclude?

(a) Transparency: location and replication. (b) Yes: independent computers coordinating solely by message passing to deliver one service; the number of machines, replication and multithreading are not part of the definition. (c) Nothing about their real order: there is no global clock, and local clocks drift.

In short
  • Keep apart: fault/failure, location/mobility, masking/tolerating, scalability/speed, openness/heterogeneity; network transparency is only access + location.
  • Tutorial 1's official answers: both definitions; visibility versus transparency; reasons (economy, reliability, availability, scalability, functional separation; motivation resource sharing); four consequences including heterogeneity.