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.
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
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.
Definition 2: Tanenbaum, the user's view
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.
The mechanism: components cooperate only by passing messages. No shared memory.
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.)
- Three machines. You only know about your PC and the file server holding your work. The DHCP server is invisible to you.
- Somewhere in the building, the DHCP server crashes. Nothing tells you: the other machines keep running. That is an independent failure.
- 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.
- After waiting, the PC times out. It has no IP address, so it cannot identify itself on the network.
- 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 | Distributed system | |
|---|---|---|
| What | A medium interconnecting computers so they can exchange messages via protocols (TCP/UDP over IP) | Autonomous computers cooperating to provide applications and services |
| Visibility | Entities are visible and explicitly addressed (IP address) | The multiplicity of computers is transparent (hidden) |
| Focus | Packets, routing | Applications, services, resource sharing |
| Relation | Provides communication | Built 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.
"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.
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?
- CDK requires the computers to be far apart; Tanenbaum allows them in one room.
- CDK describes the mechanism (message passing only); Tanenbaum describes the user's view (it looks like one computer).
- CDK allows shared memory; Tanenbaum does not.
- 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.
- 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.
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.
- 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.
- Reliability (both). Keeping copies at several sites lets the system tolerate faults, as with long-term preservation and backup, or replicated servers.
- 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.
- 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.
- 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.
- Economy (both). Expensive resources can be shared and cheap machines combined: one printer for many users, or a "supercomputer" built from networked PCs.
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.
Anything that can usefully be shared. It may be hardware (printers, disks) or a software entity (files, databases, objects, media streams).
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.
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.
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).
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.
- Functional separation. Different computers take different roles, such as client and server.
- Inherent distribution. The information or activity is naturally spread out, as with web pages, CSCW and chains of stores.
- Load beyond one machine (scalability). When one computer can't cope, the work is spread over several.
- Reliability. Replicas and backups at several sites let the system tolerate faults.
- 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?
- A computer that stores shared files.
- A running process that accepts requests from other computers.
- A distinct part of a system that manages a collection of related resources and presents their functionality only through a set of exported operations.
- 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".
- 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.
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.
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.
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.
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.
- Three parallel worlds, each with a client (blue) and a server (red). Watch what each client can actually observe.
- In every world the client sends the same request and starts waiting.
- Case A: the network loses the request. The server never hears of it and is perfectly healthy.
- Case B: the request arrives, but the server crashes while handling it. No reply will ever come.
- Case C: the server is fine but slow (overloaded, perhaps). Its reply is on its way, but it will arrive late.
- 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.
Concurrency
Coordinate access to shared resources. Bonus: add computers to add capacity.No global clock
Clocks sync only to limited precision (ms at best), because message delays vary.Independent failures
Parts fail alone, others don't know at once; failed and slow look alike.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…
- B's event happened two seconds before A's.
- A's event happened after B's, but by an unknown amount.
- Nothing about their real order.
- 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.
- "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.
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
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.Massively multiplayer online games
MMOGs need fast response and a consistent shared world for thousands of players. Three designs exist; see the figure.Financial trading
Event-based: adapters translate many feeds into one format, and Complex Event Processing spots patterns to trade automatically.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.
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).
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.
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.
- 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).
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.
| Challenge | Question to ask of the scenario | Main remedies |
|---|---|---|
| Heterogeneity | Must different machines, OSs, networks or languages interoperate? | Internet protocols, middleware, virtual machines, standards |
| Openness | Can new services, devices or vendors be added through published interfaces? | Published interfaces, standards |
| Security | What is sensitive? Who must be authenticated? What could be disrupted? | Encryption, authentication, access control |
| Scalability | What breaks when users grow 1000×? Where is the bottleneck? | Replication, caching, hierarchy, decentralization |
| Failure handling | What if a server, link or client crashes mid-task? | Detect, mask, tolerate, recover, redundancy |
| Concurrency | Which shared resources are used at the same time? | Synchronization, transactions |
| Transparency | What should users not need to know (where, how many copies, failures, movement)? | Middleware, naming (DNS) |
| Quality of service | Are 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.
- Name it. "Scalability."
- Define it in one line. Show the marker you know what the word means.
- 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.
- 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.
- 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).
- Name the challenge. One word, bolded or underlined in your script so the marker finds it.
- Define it in one line, using the standard wording if you can.
- 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.
- Give a remedy: a named technique (replication, partitioning, caching) that fixes that instance.
- 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?
- Openness
- Transparency
- Quality of service
- 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.
- 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.
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.
| Aspect | Problem | Solution |
|---|---|---|
| Networks | Ethernet, WiFi, cellular… | The Internet protocols mask them |
| Computer hardware | Data representation differs, e.g. byte order (big- vs little-endian) | An agreed external data format (Part III) |
| Operating systems | Different APIs to the protocols (UNIX vs Windows) | Middleware |
| Programming languages | Different representations of characters, arrays, records | A common format, middleware |
| Different developers' implementations | Can't communicate without agreement | Common 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.
- 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. - It sends those raw bytes across the network exactly as they sit in memory.
- The receiver is big-endian: it reads the first byte as the most significant.
01 00 00 00means 0x01000000 to it, which is 16,777,216. Same bytes, different number. - 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
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.
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.
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
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.
Open distributed systems have three properties:
- They publish their key interfaces.
- They use a uniform communication mechanism, with published interfaces to shared resources.
- 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
| Heterogeneity | Openness | |
|---|---|---|
| About | Coping with existing platform differences | Adding or replacing components through published interfaces |
| Question | Can these different machines work together? | Can this system be extended or re-implemented? |
| Remedy | Internet protocols, middleware, VMs, agreed formats | Published interfaces, standards, conformance testing |
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?
- Key interfaces are published.
- A uniform communication mechanism with published interfaces to shared resources.
- All components come from the same vendor, so they are guaranteed compatible.
- 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.
- 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.
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.
Confidentiality
Protection against disclosure to unauthorized individuals. Access control lists (ACLs), which list who may use a resource, are one way to provide it.Integrity
Protection against alteration or corruption, such as someone changing the amount on a money order.Availability
Protection against interference with the means of access, such as a denial-of-service (DoS) attack.Non-repudiation
Proof of sending or receiving, so nobody can deny it later. A digital signature provides it.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.
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?
- Confidentiality; encryption
- Integrity; a checksum
- Non-repudiation; a digital signature
- 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
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.
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.
- 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.
- 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.
- 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.
- 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.
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.
Check yourselfSelf-test Q7: Explain the four challenges of scalable design.
- Cost of physical resources. This should grow at most O(n) with the number of users, for example one server for every 20 users.
- Performance loss. Access time should grow at most O(log n), which hierarchic structures such as DNS achieve.
- Software resources running out. IPv4's 32-bit addresses ran out, which led to IPv6's 128-bit addresses.
- 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.
- 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.
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.
The service no longer meets its specification: it is unavailable, or too slow to use. A failure is what users observe.
The cause of a failure, such as a component crash or a broken disk.
No failure despite faults: the faults are handled and hidden from users.
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.
- 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.
- 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.
- 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.
- 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).
- 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.
- A client uses a primary database. A replica on another machine is kept up to date from the primary: this duplication is the redundancy.
- Normal operation: the client's query goes to the primary, which replies.
- The primary crashes. Thanks to independent failures, the replica and the client keep running.
- 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.)
- The client fails over: it sends the query to the replica, which answers. The user sees, at worst, a short delay.
- 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
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.
- 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:
- Detecting failures, for example with checksums, although a remote crash can only be suspected.
- Masking them, for example by retransmission or mirrored disks.
- Tolerating them, by reporting the error or using timeouts.
- Recovering from them, by rollback.
- 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?
- Detecting
- Masking
- Tolerating
- 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.
- 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.
- Thread 1 adds "Smith" to bidders, at position [0]. Then the scheduler pauses it, which can happen between any two steps.
- Thread 2 runs and adds "Jones" at bidders[1].
- Thread 2 carries on and adds its amount, 111, which lands at amounts[0], the first free slot.
- Thread 1 resumes and adds 122, which lands at amounts[1].
- 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.)
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,
bidderandamount, are the shared state. Because they are private, the only way to touch them is through the two methods, which are both synchronized. bidis synchronized, so while one thread is inside it no other thread can enterbidorleaderon the same object. The check (value <= amount) and the two assignments therefore happen as one indivisible unit: nobody can sneak in between settingbidderand settingamount, 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). leaderis synchronized too. Without that, a reader could see the newbidderwith the oldamounthalfway through someone else'sbid. Synchronizing the read gives a consistent snapshot of both fields.
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.
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.
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.
- 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.
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?"
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.
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.
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.
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.
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.
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.
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.
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.
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.
| Transparency | Enables… | Example |
|---|---|---|
| Access | local and remote resources accessed with identical operations | NFS mount, Dropbox folder (not: ftp) |
| Location | access without knowing physical or network location | URLs and domain names; DNS follows an IP change |
| Concurrency | shared use without interference | two customers ordering the last book |
| Replication | multiple instances used without anyone knowing of the replicas | google.com on many hosts |
| Failure | faults concealed; tasks complete anyway | email retried until delivered; site survives a node failing |
| Mobility | resources and clients move without affecting users or programs | a call continuing across cells; process migration |
| Performance | reconfiguration to improve performance as loads vary | adding servers dynamically |
| Scaling | growth without changing structure or algorithms | more servers behind the same name, clients unchanged |
Check yourselfSelf-test Q5: List and define the eight transparencies, with examples.
- Access transparency means local and remote resources are used with the same operations, as with an NFS mount.
- Location transparency means resources are used without knowing where they are, as with URLs and DNS.
- Concurrency transparency means processes share resources without interference, so two customers ordering the last book do not disrupt each other.
- Replication transparency means replicas are used without users knowing of them, as with the google.com replicas.
- Failure transparency means faults are concealed, as when email retries until it is delivered.
- Mobility transparency means resources and clients can move without affecting users, as when a call continues across cells.
- Performance transparency means the system can be reconfigured under load.
- 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
Network transparency means access and location transparency together. These are the two that most affect how usable distributed resources are.
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.
- A browser holds a link,
http://www.a.com/page.html. DNS mapswww.a.comto the server's current IP address (the addresses here are examples). - The user clicks: 1, the browser asks DNS for the address; 2, it sends
GET /page.htmlto that address. The page loads. - 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.
- Now the page itself moves to another domain,
www.b.com. The old link still sayswww.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.
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.
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…
- all eight transparencies
- access and location transparency
- location and mobility transparency
- 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.
- 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.
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.
| # | What if… | Challenge | Remedy |
|---|---|---|---|
| 1 | Customers use different hardware, OS or data codes (ASCII/EBCDIC) | Heterogeneity | Standard protocols (TCP/IP, HTTP), middleware, agreed data formats |
| 2 | You, or a customer, move to the Caribbean | Distribution transparency (location, mobility) | DNS names, links; caching and load balancing for a consistent experience |
| 3 | Two customers order the last copy at once | Concurrency | Locks, transactions |
| 4 | The inventory DB crashes, or the customer's PC crashes mid-order | Fault tolerance | Replicated or fail-over servers, transactions with rollback |
| 5 | A break-in, sniffing, or a customer denies ordering | Security | Firewall, encryption, digital signatures (non-repudiation) |
| 6 | Millions of simultaneous visitors | Scalability | Commodity servers, load balancing, replication, caching |
| 7 | Write everything yourself? What about updates? | Openness / reuse | Open 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
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.
Each challenge earns one mark, for a definition plus its application to the lab.
- 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.
- 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.
- 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.
- 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).
- 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.
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):
- 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".
- 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.
- 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.
- 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).
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.
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.
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/htmlorimage/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.
- Three participants: the Browser, DNS, and the web server named
www.cdk5.net. The user has asked forhttp://www.cdk5.net/WebExample/earth.html. - The URL contains a DNS name, not an address, so the browser first asks DNS to resolve www.cdk5.net.
- DNS replies with the server's IP address. (This is location transparency at work.)
- 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.
- The server replies 200 OK (success) and labels the content text/html, its MIME type.
- The browser, the only party that interprets HTML, parses the page and finds an embedded image it doesn't yet have.
- Because HTTP fetches one resource per request, it sends a second request, GET /WebExample/Images/earth.jpg.
- 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.
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
Dangling links
Move a resource and the links to it break, because URLs name the server's domain (the stepper in 1.9).Lost in hyperspace
Following link after link, users can lose track of where they are and how they got there.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
- 4
- 5
- 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.
- 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.
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.
Common pitfalls
- 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.
- 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.