CT 703 · BCT · Year IV Part I · 80 marks · 3 hours

Distributed System

A working reader for CT 703, built around every question the Institute of Engineering has set since 2067. This is a theory and mechanism subject: marks come from a clean definition, the right list, a labelled diagram and the steps of an algorithm. So the chapters teach the ideas with the course's own figures, every question ever asked is answered in the words to write, and the algorithms are set out step by step in their own panel.

22
past papers read
265
questions, all here
132
exam answers written
80
marks in the paper
2067 Mangsir to 2081 Bhadra Regular and Back papers Attempt all questions Pass 32 of 80

Where the marks actually areThe paper walks the syllabus

Every question from the 22 sittings was filed against the ten chapters of the syllabus, and its marks shared among the chapters it touches. Chapter 2, Distributed objects and file system, carries about 22 of the 80 marks on its own. No chapter is ever skipped: in a normal sitting every one of the ten is worth at least a short note.

The blueprint of the paper

The paper walks the syllabus from front to back, so the question number tells you the chapter before you read it. The last question is always short notes.

QuestionUsually fromHow often
Q1Chapter 1, Introduction23 of the 23 papers that set a Q1
Q2Chapter 2, Distributed objects and file system17 of the 23 papers that set a Q2
Q3Chapter 2, Distributed objects and file system20 of the 25 papers that set a Q3
Q4Chapter 5, Time and state7 of the 24 papers that set a Q4
Q5Chapter 5, Time and state9 of the 23 papers that set a Q5
Q6Chapter 6, Coordination and agreement12 of the 23 papers that set a Q6
Q7Chapter 7, Replication10 of the 22 papers that set a Q7
Q8Chapter 8, Transactions and concurrency control13 of the 28 papers that set a Q8
Q9Chapter 9, Fault tolerance8 of the 41 papers that set a Q9
Q10Chapter 9, Fault tolerance9 of the 25 papers that set a Q10
Q11Chapter 10, Case studies2 of the 8 papers that set a Q11
  • Q1 is chapter 1 in almost every sitting: a definition worth two marks, then a list worth six or eight.
  • The middle of the paper is the mechanism half: clocks, mutual exclusion, election, replication and commit protocols, each wanting an algorithm and a diagram.
  • The last question is short notes, and it repeats: MACH, JINI, process resilience, CORBA services, distributed deadlock and recovery come round again and again.

How to use this reader

  • Chapters 1 to 10 are the study content: the idea explained in plain language, the course's own diagrams, the lists, and an In the exam box saying how each card is asked.
  • Theory answers gives the exam answer to every question that asks what a thing is, written at the length its marks deserve.
  • Practical answers gives the ones that ask how a thing works: the algorithms and the protocols, step by step, in the order to write them.
  • Question bank reproduces all 265 questions word for word, each linked to its answer.
  • Mind map draws each chapter as its lists; Close all turns it into a test.
  • Rules and formulas and Flashcards for the last days.

Writing the paper

  • About two minutes a mark: 180 minutes for 80 marks. An 8 mark question gets sixteen minutes, not half an hour.
  • Every answer has the same shape: a one line definition, the list or the steps, a labelled diagram where one exists, and an example.
  • Read the marks split. "2+6" is two questions: give the definition two marks of ink and spend the rest on the mechanism.
  • Draw even when it is not asked for anything with an architecture: RMI, the file service, CORBA, the commit protocols, the replication models.
  • For an algorithm, number the steps. A marker looks for the steps, the message count and the example, in that order.

The whole subject on one page

Ten chapters and every topic card in them. The number beside a topic is how many of the 22 sittings asked it.

THE WHOLE SUBJECT ON ONE PAGE Every chapter and every topic card, with the number of the 22 sittings that asked it. Bold: eight or more. CT 703 80 marks, 3 hours 3. OS support 1 Where the OS sits, and what it must... 5 Why a distributed system needs threads 6 One big kernel, or a small one with... 6 Three answers to "make these machine... 1. Introduction 10 Definition 1 Where you already use one 2 Concurrency, no global clock, indepe... 4 Why anyone leaves a centralized system 2 Six advantages, three real costs 7 The four goals a designer aims at 6 The eight forms of transparency 9 The five challenges, and why each on... 6 Architectural, fundamental and Enslo... 2 Styles, tiers, and how work is sprea... 1 The three families you meet in pract... 2. Objects and files 7 Objects that live in another process 5 RMI, the request reply protocol, and... 8 RPC 6 The comparison the paper asks for ev... 8 Proxy, dispatcher, skeleton, and the... 1 When the server has to speak first 9 What a DFS is, and the requirements... 6 Does the server remember you between... 7 Three modules, and what each one owns 10 NFS 3 HDFS 3 Moving the computation to the data 2 Why naming exists at all 7 DNS 4. CORBA 4 What actually differs, and why it di... 5 The layer that makes heterogeneity s... 10 What CORBA is, and the components to... 3 Two ways to issue a request, and whe... 2 The four services the object adapter... 9 The services to name, with one line... 5. Time and state 10 Why no two computers agree on the time 4 Ask a time server, and halve the rou... 2 Nobody knows the right time, so agre... 3 NTP 11 Lamport's clock 5 An array instead of a counter, and n... 2 Delivering messages in the order tha... 4 What a global state is, and when a c... 2 Recording a consistent state while t... 3 Asking whether a property ever held 6. Coordination 5 The problem, and the three requireme... 3 Ask one machine for permission 1 Every process keeps the queue, order... 6 Drop the release message, and defer... 4 Whoever holds the token may enter 3 The comparison, with the message cou... 9 Choosing a new coordinator when the... 2 Chang and Roberts 3 Sending to a group, reliably and in... 5 Getting independent processes to dec... 6 Agreement when some of the participa...
What the picture says
  • Chapter 2 is the heaviest, at about 22 marks a paper.
  • Chapters 1 and 2 open every paper, and between them are worth nearly a quarter of it.
  • The short notes repeat: MACH, JINI, process resilience and CORBA services come round in many papers, and they are four easy marks each.

How to read the chips

ChipMeans
TOP n/22Asked in 8 or more of the 22 sittings.
HOT n/22Asked in 4 to 7 sittings.
PIN n/22Asked in 1 to 3 sittings.
DECKIn the syllabus and the lecture slides, but never yet set in an exam; taught here, and never counted.
2+6The marks the question has carried.

Under each chip is the list of sittings that asked it. Bold is a Regular sitting, plain is a Back sitting.

CodeMonthCodeMonthCodeMonth
BaBaishakhShrShrawanKaKartik
AsaAshadBhBhadraChChaitra
AshAshwinMaMangsir

Chapter 1 · 4 hours · about 10 marks a paper · in all 22 sittings, and it is question 1 in every one

Introduction to distributed systems

What a distributed system actually is, why anyone builds one, the three properties that make it different from an ordinary computer, the goals a designer aims at, and the five challenges that make those goals hard. Almost every paper opens here, so this chapter is the cheapest marks in the subject.

What this chapter is about
  • The definition: many independent computers, joined only by messages, that look to the user like one machine.
  • The properties: concurrency, no global clock, and independent failures. Everything hard in the other nine chapters comes out of these three.
  • The goals: resource sharing, openness, transparency and scalability, which is what a designer is trying to achieve.
  • The challenges: transparency, scalability, dependability, performance and flexibility, which is what fights back.
  • The shapes: the models a distributed system is described with, and the three families you meet in practice, grid, cluster and cloud.
Where it fits
  • "No global clock" becomes chapter 5. Because no two machines agree on the time, you need logical clocks to order events.
  • "Independent failures" becomes chapters 7 and 9. Because any one machine can die on its own, you replicate services and build fault tolerance.
  • "Concurrency" becomes chapters 6 and 8. Because many machines act at once, you need mutual exclusion, election and concurrency control.
  • "Transparency" becomes chapters 2, 3 and 4. Remote calls, file systems and middleware exist to hide the distribution from the programmer.
What you will learn
  1. 1.1 What a distributed system is
  2. 1.2 Examples: the internet, the web, mobile networks, DNS
  3. 1.3 The three main characteristics
  4. 1.4 Centralized, parallel and distributed compared
  5. 1.5 Advantages and disadvantages
  6. 1.6 Design goals
  7. 1.7 Transparency and its eight forms
  8. 1.8 Design challenges, the five problems
  9. 1.9 Models of a distributed system
  10. 1.10 Architectural styles and how work is spread
  11. 1.11 Resource sharing and the web
  12. 1.12 Grid, cluster and cloud
  13. 1.13 Last minute recall, chapter 1
How it is examined
  • Question 1 is from this chapter in all 22 papers, and it is worth 8 to 10 marks almost every time.
  • The shape barely changes: a two mark definition, then a six or eight mark list. The list is goals, or challenges, or transparency, or advantages.
  • It is pure recall, so learn the four lists cold. Nothing here needs derivation or calculation.

1.1What a distributed system is

Definition: many computers, one system TOP 10/22

81 Bh · 81 Ba · 80 Bh · 78 Bh · 76 Ch · 75 Ash · 72 Ka · 71 Ch · 70 Ch · 70 Asa2+62+86+2

Distributed system A collection of independent computers at networked locations that communicate and coordinate only by passing messages, and that appears to its users as a single coherent system.

Read that definition as three separate claims, because an examiner marks each one. First, the machines are independent: each has its own processor, its own memory and its own clock, and each could be switched off without permission from the others. Second, the only way they can affect each other is by sending a message over a network, because there is no shared memory for them to write into. Third, the user is not supposed to notice any of this: the whole point is that the collection behaves like one machine.

Lecture note figure: c computers C1, C2 up to Cc, each a dashed box holding a local memory M and a processor P, every processor wired down to one wide box labelled Interconnection Network N
The standard picture. Each dashed box is one independent computer: a processor P with its own memory M. Nothing is shared between the boxes. The only link is the interconnection network at the bottom, and the only traffic on it is messages. From the Chapter 1 lecture notes

Why "single coherent system" is the load bearing phrase. A paper often quotes it and asks you to justify it (2071 Chaitra). The justification is that the user sees one interface, one name for a resource and one answer, while the system quietly decides which machine actually serves the request. When you use Gmail you do not choose a server, do not know which country holds your mail, and do not care that the machine that answered you yesterday has since been replaced. That illusion is what distinguishes a distributed system from a mere network of computers.

Three terms that are easy to confuse, and are worth separating before you meet them in a question:

  • Distributed program: a program written to run across several machines of a distributed system at once.
  • Distributed programming: the practice of writing such programs, which means thinking about messages, failures and ordering instead of about a single call stack.
  • Distributed computing: the general field, the one this subject is about.

A distributed system is not a parallel system. In a parallel computer every processor reaches the same shared memory, so processors exchange information by writing to an address that the others can read. In a distributed system each computer has its own private memory, so the only exchange possible is a message across a network. That single difference is why delay, message loss and partial failure dominate everything in this course, and why a parallel algorithm cannot simply be moved onto a distributed system.

A network is not a distributed system either. The internet by itself only carries packets. What makes the web, or DNS, or a banking network a distributed system is the layer of software running above the network that coordinates those machines into a single service. Your lecture notes make this point explicitly: the internet provides the communication channels, and the services built on top of it are the distributed systems.

Asked on the paper, word for word
  • Define distributed system (DS). Briefly discuss about the models of DS. 2081 Bhadra Q1 · 2+6
  • What is Distributed System (DS)? Write the importance and goals of DS. 2081 Baishakh Q1 · 2+8
  • Define the term "distributed system". In terms of qualities, advantages and complexities, Compare it with the centralized systems. 2080 Bhadra Q1 · 2+6
  • What do you mean by Distributed System (DS)? Explain various models of Distributed Computing Systems. 2078 Bhadra Q1 · 2+6
  • Define Distributed System (DS). Explain the requirements to successfully implement DS to suit to modern computing. 2076 Chaitra Q1 · 2+8
  • Define distributed system? Explain Transparency Properties of Distributed System. 2075 Ashwin Q1 · 2+6
  • What is Distributed System? Discuss the challenges of Distribution System with example. 2072 Kartik Q1 · 2+6
  • "Distributed system acts as a single coherent system to its end user." Justify the statement with its features and challenges. What is fundamental model? 2071 Chaitra Q1 · 6+2
  • Define Distributed System, What are advantages and disadvantages of distributed system? 2070 Chaitra Q1 · 2+6
  • How do you define Distributed System? Explain with the model, how hardware, data and controls are distributed in the distributed system environment. 2070 Ashad Q1 · 2+6
In the exam
  • Write the definition in one sentence and make sure the three phrases appear: independent computers, message passing, single coherent system. Two marks, every year.
  • If the question says "justify", give the definition, then one example (the web), then say what the user sees against what is really happening.

1.2Examples of distributed systems

Where you already use one PIN 1/22

73 Shr3+5

Papers ask for "principle applications" (2073 Shrawan) or just "examples", and a bare list earns less than a list with one line of justification each. Keep four ready, and for each one be able to say what is distributed and what the user sees instead.

  • The internet and the world wide web. The web is a vast collection of servers holding pages, images and scripts. You type one address and a browser assembles a page out of pieces fetched from several machines, often on different continents. What is distributed: the documents and the servers. What the user sees: one page.
  • Mobile and cellular networks. Coverage is split into cells, and each cell is served by its own base transceiver station, normally three sites per area. The stations hand your call from one cell to the next as you move. What is distributed: the radio equipment and the subscriber records. What the user sees: one uninterrupted call.
  • DNS, the domain name system. No single machine holds the name to address mapping for the whole internet. The database is split across millions of name servers arranged in a hierarchy, and a lookup walks that hierarchy. What is distributed: the database. What the user sees: one answer to one query. This is the standard example of a distributed database, and chapter 2 studies it in full.
  • Banking and airline reservation. These are inherently distributed: the branches and the booking counters exist in different cities whether you like it or not, so the system must be built that way. A customer deposits at one branch and withdraws at another against the same balance.

Add a Nepali example if you want the extra mark. An eSewa or Khalti payment touches a wallet server, a bank switch and a merchant system in one transaction, and the user sees a single "payment successful" line. It is the same shape as the banking example, with the advantage that the examiner recognises it.

A distributed database, defined, since the papers use the term in its own right: a database whose storage devices are not all attached to one processor. The pieces may sit in one room or be spread across the world, and unlike a parallel database, the sites are loosely coupled and share no physical components.

Asked on the paper, word for word
  • What are the principle applications of Distributed System (DS)? Discuss the advantages and disadvantages of DS. 2073 Shrawan Q1 · 3+5

1.3The three main characteristics

Concurrency, no global clock, independent failures PIN 2/22

71 Shr · 67 Mng3+76+2

These three are the heart of the subject. They are not a list to memorise and forget: each one creates a whole later chapter. Learn them with their consequence attached.

The three characteristics Concurrency of components, no global clock, and independent failures of components.

1. Concurrency. Many programs on many machines run and share resources at the same instant. A web application is concurrent because thousands of users act on it simultaneously; a shared file server is concurrent because several clients write to the same directory. The gain is real: work split into pieces that run at once lowers latency and raises throughput. The cost is that two machines may try to change the same thing at the same moment, which is why you will spend chapter 6 on mutual exclusion and chapter 8 on concurrency control.

2. No global clock. Each computer keeps its own clock, and no two physical clocks tick at exactly the same rate. When programs need to agree on the order of events, the obvious idea of stamping each event with the local time fails, because those times are not comparable. There is no single correct global timing system to appeal to, and the only thing the machines share is messages. Chapter 5 is the answer to this: Cristian's algorithm and NTP pull physical clocks closer together, and Lamport and vector clocks give an ordering that needs no clock at all.

3. Independent failures. Any single computer, or any single link, can fail while the rest carry on. This is genuinely different from a centralized system, where the server failing ends the story. It cuts both ways:

  • The good side: the system as a whole survives. If one node dies, the others take its share of the work, so the service stays up for the end user. This is the basis of the reliability advantage in section 1.5.
  • The hard side: a program cannot tell the difference between a node that has crashed, a node that is merely slow, and a network that has dropped a message. This is called partial failure, and it is the reason chapter 9 exists.

A paper that asks for "properties" or "features" of a distributed system (2071 Shrawan) wants exactly this list, usually with the design goals attached.

Asked on the paper, word for word
  • Discuss the properties of Distributed System (DS). How interaction model addresses the relevant issues in DS? 2071 Shrawan Q1 · 6+2
  • Discuss the important characteristics of Distributed Systems. Explain distribution transpareny goal of distributed systems 2067 Mangsir Q1 · 3+7

1.4Centralized, parallel and distributed

Why anyone leaves a centralized system HOT 4/22

80 Bh · 79 Bh · 75 Ch · 72 Ch2+64+4

Several papers ask this directly: "differentiate centralized and distributed" (2072 Chaitra), "why is a distributed system preferred over a centralized system" (2075 Chaitra), "compare in terms of qualities, advantages and complexities" (2080 Bhadra). One table answers all three.

PointCentralized systemDistributed system
ComponentsOne machine does the processing, terminals only displayMany independent machines, each able to process
MemoryOne memory, one clockPrivate memory and a private clock per node
FailureServer fails, everything stops: a single point of failureOne node fails, the rest carry on
ScalingBuy a bigger machine, and there is a ceilingAdd more ordinary machines, incrementally
CostHigh: mainframe class hardwareLower: many cheap microprocessors
Speed limitThe speed of one processorThe sum of many processors, if work divides
ComplexitySimple to build, reason about and secureHard: coordination, consistency, security, debugging
DataAll in one place, always consistentSpread and often replicated, so consistency must be engineered

Where "decentralized" and "networked" fit. The lecture slides draw a three way split that is worth a line in an answer. A system is centralized if its components are all at one site. It is decentralized if components are at different sites with little or no coordination. When a decentralized system has no coordination it is merely networked; when those scattered components do coordinate closely, it is distributed. Coordination, not geography, is what makes it distributed.

And the parallel system, which examiners like to slip into the same question: its processors are tightly coupled and share one memory, so it is fast but bounded by one box. A distributed system is loosely coupled and shares nothing, so it is slower per message but unbounded in size.

The four reasons a distributed system is preferred, if you have room for only four:

  • Better price to performance: many cheap microprocessors beat one large machine.
  • No single point of failure: one node dying leaves the service running.
  • Incremental growth: add a machine rather than replace the system.
  • Resource sharing across sites, which a single machine cannot offer at any price.
Asked on the paper, word for word
  • Define the term "distributed system". In terms of qualities, advantages and complexities, Compare it with the centralized systems. 2080 Bhadra Q1 · 2+6
  • Transparency is one of the important design goals of distributed system. Justify it. List out the advantages of distributed system over centralized system. 2079 Bhadra Q1 · 4+4
  • Why distributed system is preferred over centralized system? Explain the layers of transparency. 2075 Chaitra Q1 · 4+4
  • Differentiate between centralized and distributed system? Explain the design issues related to distributed system. 2072 Chaitra Q1 · 2+6

1.5Advantages and disadvantages

Six advantages, three real costs PIN 2/22

73 Shr · 70 Ch2+63+5

This is one of the most repeated questions in the subject (2073 Shrawan, 2070 Chaitra, 2079 Bhadra and more). The list below is the one your lecture notes give, so use these headings and these examples.

The six advantages, each with the reason it holds:

  • Economic. A collection of microprocessors gives a better price to performance ratio than a mainframe. Many ordinary machines cost far less than one very large one for the same total power.
  • Speed. The total computing power can exceed any single machine. The standard figure from the notes: 10,000 CPU chips at 50 MIPS each is 500,000 MIPS, and no single processor can reach that, because it would need an instruction cycle of 0.002 nanoseconds. Work is also spread by load distribution, so no one machine is the bottleneck.
  • Inherent distribution. Some applications are distributed whether you want it or not: worldwide airline reservation, and a bank where a customer deposits or withdraws at any branch. Building them centrally would be the unnatural choice.
  • Reliability. If one machine crashes, the system as a whole survives, giving higher availability. Add replication (chapter 7) and the service does not even blink.
  • Incremental growth. Computing power is added in small steps, which is modular expandability. You do not replace the system to grow it; you add a node.
  • The deriving force. Large numbers of personal computers already exist, and people need to collaborate and share information. The hardware and the demand both arrived first.

The disadvantages are fewer but serious, and an answer that lists only advantages loses marks when the question says "and disadvantages":

  • Hard and expensive to build. Distributed software is much more difficult to write correctly than software for one machine, which makes the whole system costlier.
  • Coordination overhead. Every exchange of information between components needs coordination, and that coordination is itself processing and network traffic that does no useful work.
  • Correctness is hard to guarantee. It is difficult to be sure an algorithm is correct when parts of the system are down or in the middle of recovering.

Two more that examiners accept and that the slides list under disadvantages: the network itself becomes a weakness, since saturation or lossy transmission degrades everything, and security gets harder, because easy access to data is easy access for everyone. Add them if the question is worth six marks or more.

Asked on the paper, word for word
  • What are the principle applications of Distributed System (DS)? Discuss the advantages and disadvantages of DS. 2073 Shrawan Q1 · 3+5
  • Define Distributed System, What are advantages and disadvantages of distributed system? 2070 Chaitra Q1 · 2+6

1.6Design goals

The four goals a designer aims at HOT 7/22

81 Bh · 81 Ba · 80 Ba · 76 Ash · 69 Ch · 68 Ch · 68 Ba4+42+86+2

"Goals of DS" appears as a short note and as an eight mark question. The four are resource sharing, openness, transparency and scalability. Take them in that order, because transparency is large enough to have its own card next.

1. Resource sharing, the main goal. Users should be able to reach remote resources, a printer, a database, a file, a search engine, and share them in a controlled and efficient manner. The point is not only convenience:

  • It lowers cost, because one expensive resource serves many users instead of one per user.
  • It enables collaboration, which is why people wanted networks in the first place.
  • It creates the security problem. Making sharing easy makes unauthorised access easy too, so a sharing system must also be a protecting system.

2. Openness. An open system offers its services by published, standard rules that fix the syntax and semantics of each service, so anyone can write a component that fits. In practice that means publishing interfaces, and the interfaces are written in an Interface Definition Language.

IDL, the interface definition language A language for specifying a service's interface: the function names, the parameters, the return values, the possible exceptions and what the service is for. The specification must be complete (everything needed to implement it is stated) and neutral (it does not dictate how it is implemented).

Openness buys two properties that papers ask for by name. Interoperability is the ability of two independent implementations to work together by relying on each other's published services. Portability is the ability of an application written for one distributed system to run correctly on another that offers the same interfaces, without being modified. Both follow from the same act of publishing the interface, and both are why you can add or replace a component later without disturbing the rest.

IDL comes back twice: in chapter 2 for RMI, and in chapter 4 where CORBA IDL is the whole basis of the architecture.

3. Transparency is hiding the fact that the resources and processes are spread over many machines, so the user sees one coherent system. It is big enough that the next card is entirely about it.

4. Scalability. A system is scalable if it keeps working well as it grows. Growth comes in three independent directions, and a design can scale in one while failing in another:

  • Size: more users and more resources can be added.
  • Geography: users and resources may sit anywhere, however far apart.
  • Administration: the system stays manageable even when it spans many independent administrations, each with its own rules.

Neuman's test, worth quoting: a system is scalable if it can absorb added users and resources without a noticeable loss of performance or increase in administrative complexity. Notice that the test has two halves, performance and administration, and most designs fail on the second one first.

Asked on the paper, word for word
  • Write short notes on: Goals of DS 2081 Bhadra Q10b · 4
  • What is Distributed System (DS)? Write the importance and goals of DS. 2081 Baishakh Q1 · 2+8
  • Explain the design goals and challenges in distributed system. What is fundamental model? 2080 Baishakh Q1 · 6+2
  • What are the major goals of distributed system and what are the challenges during the design of distributed system. 2076 Ashwin Q1 · 8
  • What are the major goals of distributed system? Explain the need of transparency in distributed system along with the challenges in achieving that. 2069 Chaitra Q1 · 4+4
  • Describe precisely what is meant by a scalable system. Explain distribution transparency in Distributed Systems. 2068 Chaitra Q1 · 4+4
  • What are goals of distributed system? Explain scalability goal in detail. 2068 Baishakh Q1b · 5

1.7Transparency

The eight forms of transparency HOT 6/22

79 Bh · 75 Ch · 75 Ash · 69 Ch · 68 Ch · 67 Mng4+42+63+7

Transparency Hiding from the user and the application programmer that the components of the system are separated, so the system is perceived as a whole rather than a collection of independent components.

The name is a little backwards at first reading. Transparent here does not mean "you can see through to the machinery"; it means the machinery is invisible. The goal is often called the single system image: a collection of computers that looks like one computer.

Lecture note table: the eight forms of transparency, access, location, migration, relocation, replication, concurrency, failure and persistence, each with a one line description of what it hides
The eight forms, as the lecture notes give them. Learn the left column in order and one phrase of the right column for each. Almost every year a question is worth four to eight marks for exactly this table. From the Chapter 1 lecture notes

What each one hides, with the example that makes it stick:

  • Access: hides the difference in data representation and how a resource is reached. You open a remote file with the same call you use for a local one.
  • Location: hides where a resource is. A URL names a page without telling you which machine holds it.
  • Migration: hides that a resource may move to another location. Your mailbox moves to a new server and your address does not change.
  • Relocation: hides that a resource may move while it is in use. This is the one students drop: migration is moving between uses, relocation is moving during use, such as a phone call surviving a handover between cells.
  • Replication: hides that there are several copies. You read "the" file and never learn which of the four replicas answered.
  • Concurrency: hides that the resource is being shared by several competing users at the same time.
  • Failure: hides the failure and recovery of a resource. A retry against another replica turns a crash into a slightly slower response.
  • Persistence: hides whether a resource is in memory or on disk.

Total transparency is not actually wanted, and saying so earns marks in the "challenges" question. Hiding everything costs performance, and pretending a remote operation is local misleads the programmer about what it costs. The notes give a neat example: if you print from your phone, strict location transparency would let the system pick any printer in the world, when what you want is the printer in this room. Here breaking location transparency gives the better outcome.

Asked on the paper, word for word
  • Transparency is one of the important design goals of distributed system. Justify it. List out the advantages of distributed system over centralized system. 2079 Bhadra Q1 · 4+4
  • Why distributed system is preferred over centralized system? Explain the layers of transparency. 2075 Chaitra Q1 · 4+4
  • Define distributed system? Explain Transparency Properties of Distributed System. 2075 Ashwin Q1 · 2+6
  • What are the major goals of distributed system? Explain the need of transparency in distributed system along with the challenges in achieving that. 2069 Chaitra Q1 · 4+4
  • Describe precisely what is meant by a scalable system. Explain distribution transparency in Distributed Systems. 2068 Chaitra Q1 · 4+4
  • Discuss the important characteristics of Distributed Systems. Explain distribution transpareny goal of distributed systems 2067 Mangsir Q1 · 3+7
In the exam
  • "Layers of transparency" and "forms of transparency" mean the same table. Give all eight with a phrase each, then one line on why full transparency is undesirable.

1.8Design challenges

The five challenges, and why each one fights the others TOP 9/22

80 Ba · 76 Ch · 76 Ash · 74 Ash · 72 Ch · 72 Ka · 71 Ch · 69 Ch · 68 Ba2+66+22+8

Your lecture notes organise this as five challenges, and that is the list to reproduce: transparency, scalability, dependability, performance and flexibility. The reason this question is worth six or eight marks is that the examiner wants the tension, not just the names: every one of these pulls against at least one other.

  • 1. Transparency as a challenge. Full transparency trades against performance and scalability, and it confuses local with remote operations. It is also not always achievable, because there are physical limits on how fast a message crosses a wide area network.
  • 2. Scalability as a challenge. Growth breaks systems in three ways. Size: more users and resources overload a design that must process every request. Geography: greater distance means greater delay and more chance of communication failure. Administration: as it grows, a system crosses administrative domains, each with its own policies.
  • 3. Dependability as a challenge. This is the subtle one. Distribution offers higher availability through replication, but it also means more components must work for a single service to function. Dependability then demands consistency, security, concurrency control and fault tolerance together, and all four are hard.
  • 4. Performance as a challenge. Every system wants maximum performance, but in a distributed system performance conflicts directly with transparency, security, dependability and scalability. Each of those is bought with extra messages, extra checks or extra copies, and each costs time.
  • 5. Flexibility as a challenge. A flexible system can be configured to give exactly the services a user needs, which requires extensibility, openness and interoperability. Those contradict the other desirable properties, which is why flexible systems are rarely also simple or fast.

The Coulouris list is the alternative answer and some questions (2074 Ashwin, 2072 Kartik) are phrased to expect it. It names the challenges as heterogeneity, openness, security, scalability, failure handling, concurrency, transparency and quality of service. If a question says "challenges associated with different requirements", give this list with a line each; if it says "design challenges", give the five above. Either is accepted when each item carries a reason.

Pitfalls: the false assumptions, a favourite short note (2068 Baishakh). Every one of these is something a first time developer silently assumes and is always wrong about: the network is reliable; the network is secure; the network is homogeneous; the topology does not change; latency is zero; bandwidth is infinite; transport cost is zero; there is one administrator.

True Distributed System A distributed system in which all five challenges have been solved to their full extent. It is a target, not a product: new components, security and software complexity mean a TDS is virtually impossible to build in practice.
Asked on the paper, word for word
  • Explain the design goals and challenges in distributed system. What is fundamental model? 2080 Baishakh Q1 · 6+2
  • Define Distributed System (DS). Explain the requirements to successfully implement DS to suit to modern computing. 2076 Chaitra Q1 · 2+8
  • What are the major goals of distributed system and what are the challenges during the design of distributed system. 2076 Ashwin Q1 · 8
  • Why there are challenges in achieving some requirements of a distributed system? Explain the challenges associated with different requirements of distributed system. 2074 Ashwin Q1 · 2+6
  • Differentiate between centralized and distributed system? Explain the design issues related to distributed system. 2072 Chaitra Q1 · 2+6
  • What is Distributed System? Discuss the challenges of Distribution System with example. 2072 Kartik Q1 · 2+6
  • "Distributed system acts as a single coherent system to its end user." Justify the statement with its features and challenges. What is fundamental model? 2071 Chaitra Q1 · 6+2
  • What are the major goals of distributed system? Explain the need of transparency in distributed system along with the challenges in achieving that. 2069 Chaitra Q1 · 4+4
  • Discuss pitfalls of distributed system. 2068 Baishakh Q1a · 5

1.9Models of a distributed system

Architectural, fundamental and Enslow's model HOT 6/22

81 Bh · 80 Ba · 78 Bh · 71 Ch · 71 Shr · 70 Asa2+66+2

"Models of DS" is asked in three different senses, and the safest answer covers all three briefly and then expands the one the question names. The three senses are the physical and architectural model (what the parts are and how they are arranged), the fundamental model (what you are allowed to assume about them), and Enslow's model (how far the system is decentralized).

1. The architectural model describes the parts and their roles:

  • Client server: a passive server holds a resource and waits; an active client sends a request and waits for the reply. Simple, and the basis of the web, DNS and NFS.
  • Peer to peer: every node is both client and server, and there is no central authority. Scales well, and is harder to secure and manage.
  • Multiple servers, proxy and cache, mobile code and mobile agents are the variations built on top of those two.
Lecture slide: the client server model drawn against a time axis, the client sending a request, the server providing the service while the client waits for the result, and the reply arriving back at the client
Client server, drawn against time. The client sends the request and blocks; the server does the work; the reply returns. Every remote call in chapter 2 is this diagram with more layers drawn in. From the Chapter 1 lecture slides

2. The fundamental models state the assumptions an algorithm is allowed to make. There are three, and papers ask "what is fundamental model" as a two mark tail (2080 Baishakh, 2071 Chaitra):

  • Interaction model: how processes communicate and what you may assume about timing. A synchronous system has known bounds on message delay, processing time and clock drift; an asynchronous system has no bounds at all, which is what the internet really is. Most hard results in this subject come from that distinction.
  • Failure model: what kinds of failure can occur, so an algorithm can say what it tolerates. Omission failures (a process or channel fails to do something, such as crashing or dropping a message), arbitrary or Byzantine failures (a process does the wrong thing, possibly maliciously), and timing failures (right answer, too late), which only exist in a synchronous system.
  • Security model: what the threats are, which means assuming an enemy can copy, alter, replay or inject messages, and defining which principals may perform which operations.

The failure model here is the short version of chapter 9, and the arbitrary case becomes the Byzantine generals problem.

3. Enslow's model answers the question "how distributed is it, really". Enslow said a system is distributed only if all three of these are decentralized to a degree:

Lecture slide: Enslow's model drawn as a three dimensional cube, hardware decentralisation H1 to H5 up the vertical axis, control decentralisation C1 to C6 across, database decentralisation D1 to D6 in depth, with the allowable region for distributed systems marked in the far corner
Enslow's cube. Hardware decentralisation H1 to H5 up, control decentralisation C1 to C6 across, and database decentralisation D1 to D6 in depth. Only the marked corner, where all three are high, counts as a distributed system. From the Chapter 1 lecture slides
  • Hardware: from one CPU with one control unit, through multiprocessors, up to multicomputers with multiple CPUs, multiple I/O systems and local memories.
  • Control: from a single fixed control point, through fixed and then dynamic master and slave arrangements, up to multiple heterogeneous control points.
  • Data: from a centralized database with a single copy, through replicated and partitioned databases, up to a partitioned database with no master file or directory.

So the one line answer to "how are hardware, data and control distributed" (2070 Ashad Q1) is: a system counts as distributed when it sits high on all three axes at once, and a system that decentralizes only the hardware is a multicomputer, not a distributed system.

Asked on the paper, word for word
  • Define distributed system (DS). Briefly discuss about the models of DS. 2081 Bhadra Q1 · 2+6
  • Explain the design goals and challenges in distributed system. What is fundamental model? 2080 Baishakh Q1 · 6+2
  • What do you mean by Distributed System (DS)? Explain various models of Distributed Computing Systems. 2078 Bhadra Q1 · 2+6
  • "Distributed system acts as a single coherent system to its end user." Justify the statement with its features and challenges. What is fundamental model? 2071 Chaitra Q1 · 6+2
  • Discuss the properties of Distributed System (DS). How interaction model addresses the relevant issues in DS? 2071 Shrawan Q1 · 6+2
  • How do you define Distributed System? Explain with the model, how hardware, data and controls are distributed in the distributed system environment. 2070 Ashad Q1 · 2+6

1.10Architectural styles

Styles, tiers, and how work is spread across machines PIN 2/22

68 Ba · 67 Mng52+4+43

This card answers the architecture questions from the older papers (2068 Baishakh, 2067 Mangsir) and gives you the vocabulary that chapter 2 assumes.

Architectural style The organisation of a system in terms of its components, how they are connected, the data exchanged between them and how those elements are configured together.

The four common styles, each defined by how components talk:

  • Layered: each layer may call only the layer below, and a reply comes back up. Networking protocol stacks are the model example. Easy to reason about, and slow if there are many layers.
  • Object based: components are objects, and they call each other's methods over the network. This is exactly what chapter 2's RMI and chapter 4's CORBA implement.
  • Event based: components publish events and others subscribe, so the sender does not know the receivers. This gives referential decoupling: the publisher and subscriber need no knowledge of each other.
  • Shared data space: processes communicate by putting tuples into a shared space and taking them out. Decoupled in time as well, since sender and receiver need not be running together.

Centralized architectures mean the client server family, and the useful part of the question is how the application is split. An application has three logical parts: the user interface, the processing or application logic, and the data. Which machine gets which part is called vertical distribution:

Lecture slide: a three tier architecture as a time diagram, the user interface layer sending a request operation to the application server, which requests data from the database server, and the replies returning back up the same path
Three tiers. The interface machine asks the application server, which asks the database server, and the replies unwind. The middle server is a client of the database while being a server to the interface, which is the point of the diagram. From the Chapter 1 lecture slides
  • Two tier: the split falls between two machines. A thin client keeps only the display; a fat client also runs the processing and sometimes part of the data handling.
  • Three tier: interface, application logic and data each get their own machine, so the middle tier is a server to the front and a client to the back.

Horizontal distribution is the other axis, and it is the one that scales. Instead of splitting an application into different parts, you make several identical copies of the same part and split the requests between them.

Lecture slide: horizontal distribution, a front end handling incoming requests in round robin fashion across several replicated web servers that each hold the same web pages and disks, with the internet drawn as a cloud below
Horizontal distribution. A front end hands incoming requests round robin to several web servers that all hold the same pages. Add a server and you add capacity, which is what vertical splitting cannot do. From the Chapter 1 lecture slides

Decentralized architectures are peer to peer, and they come in three kinds:

  • Structured P2P: nodes are organised into a fixed topology, normally a ring, by a distributed hash table. A key is hashed to a number and the node responsible for that number holds it, so any node can find any key in about logN hops. Chord is the standard example.
  • Unstructured P2P: no fixed topology. Each node keeps a random set of neighbours, and a search is a flood or a random walk, which may fail to find a rare item.
  • Hybrid, with super peers. Some nodes are promoted to super peers: they keep an index, and ordinary peers attach to one of them. Lookups go to the super peer, and the actual transfer is still peer to peer.

What a super peer buys you, since the question always asks for its usage: it removes the flooding cost of a pure unstructured network by keeping a local index, while avoiding the single point of failure of one central server. Cassandra is the standard modern P2P example, in which every node is equal, any node can accept a read or write, and a gossip protocol keeps the membership list up to date.

Asked on the paper, word for word
  • Define architectural styles. Describe common architectural styles. 2068 Baishakh Q2b · 5
  • Explain different centralized system architectures. 2068 Baishakh Q3a · 5
  • Discuss super peer in decentralized architecture. 2068 Baishakh Q3b · 5
  • What is an architectural style? Discuss with one example structured P2P architecture. What is a super peer, discuss its usage in P2P systems? 2067 Mangsir Q2 · 2+4+4
  • Explain any 3 of the following: P2P style of architecture of Cassandra (just discuss to show the p2p style not the entire architecture) 2067 Mangsir Q8d · 3

1.11Resource sharing and the web

Services, clients, servers and what the web taught us

Sharing means sharing a service, not a disk. Users want to share data, not the disk holding it, so a distributed system offers a service: a managed collection of related resources plus the operations on them. A file service offers read, write and delete; the files are its business, not yours.

Client and server are processes, not computers, a distinction papers test. The process that requests an operation is the client; the process that provides it is the server. The client is active and the server is passive; the server runs continuously while a client runs only as long as its application does. One machine can run both, and a web server that fetches from a database is a server to the browser and a client to the database. When a client sends a request, it is said to invoke an operation upon the server, and the complete interaction from request to response is a remote invocation.

The web is the example to quote because it is a distributed system everyone has used. It rests on three standard components:

  • HTML, the language that specifies the content of a page.
  • URL, which identifies a document or resource. It has two top level parts, the scheme and the scheme specific identifier: in http://www.example.com/notes/, http is the scheme and the rest is the identifier.
  • Client server architecture, the rules by which a browser reaches a web server. HTTP is that request and reply protocol, carrying one resource per request, and a program the server runs to build content for a client is a CGI program.

The web's own challenges are a small, easy set of marks:

  • Dangling links: a resource is deleted or moved but the links pointing at it remain.
  • Slow response from an overloaded web server.
  • A page is a poor user interface compared with a native application.

The semantic web is the proposed answer to searching this mess: a web of linked metadata resources, so search engines can work on meaning rather than on words, and find content more effectively.

1.12Grid, cluster and cloud

The three families you meet in practice PIN 1/22

68 Ba5

The syllabus lists these three by name, and the way to keep them apart is one word each: grid is heterogeneous, cluster is homogeneous, cloud is on demand.

Grid systems have a high degree of heterogeneity. The machines need not agree on hardware, operating system, network, security policy or administrative domain. Resources from different organisations collaborate through a virtual organisation, which is the set of access rights shared among its members. Its architecture has five layers:

Lecture note figure: the grid architecture as five stacked layers, fabric at the bottom, then connectivity and resource side by side, then collective, and applications on top
Grid architecture. Fabric at the bottom, then connectivity and resource, then collective, then applications. Learn it bottom up: each layer only uses the one under it. From the Chapter 1 lecture notes
  • Fabric layer: the interface to the local resources at one site, with functions to query the state and capability of a resource and to manage it.
  • Connectivity layer: the communication protocols for grid transactions, including delegation of rights from an authenticated user to a program running on their behalf.
  • Resource layer: manages a single resource using the connectivity functions and the fabric interfaces, and is responsible for access control.
  • Collective layer: handles access to multiple resources: discovery, allocation and scheduling across them, plus data replication.
  • Application layer: the applications that actually use the grid.

Cluster systems are the opposite: homogeneity is their defining feature. Every computer runs the same operating system and sits on the same network, and a single program is run in parallel across them. Clusters are for parallel computation; grids are for sharing resources across organisations.

Cloud systems provide shared processing resources and data to devices on demand, over the internet, reachable from a browser regardless of location or device. Two classifications matter:

  • Service models: SaaS (software as a service, you use the application), PaaS (platform as a service, you deploy your application onto their platform) and IaaS (infrastructure as a service, you rent machines and storage).
  • Deployment models: public, private, community and hybrid cloud.

Underneath all three is the hardware question, which older papers ask directly: is the memory shared or private, and is the interconnect a bus or a switch?

Lecture slide: the hardware taxonomy of distributed computers as a two by two table, shared memory against private memory along the top, bus based against switched along the side, with processor and memory block diagrams in each cell
The hardware taxonomy. Shared memory gives a multiprocessor; private memory gives a multicomputer. A bus is cheap and does not scale; a switched network scales and costs more. A distributed system is built on the private memory column. From the Chapter 1 lecture slides
Asked on the paper, word for word
  • Explain Distributed computing systems. 2068 Baishakh Q2a · 5

1.13Last minute recall

Chapter 1 in one screen

  • Definition, three phrases: independent computers, message passing only, single coherent system.
  • Three characteristics: concurrency, no global clock, independent failures. Each one creates a later chapter.
  • Four goals: resource sharing, openness, transparency, scalability.
  • Eight transparencies: access, location, migration, relocation, replication, concurrency, failure, persistence.
  • Five challenges: transparency, scalability, dependability, performance, flexibility. Coulouris version: heterogeneity, openness, security, scalability, failure handling, concurrency, transparency, quality of service.
  • Six advantages: economic, speed, inherent distribution, reliability, incremental growth, the deriving force. Three disadvantages: hard and costly to build, coordination overhead, correctness hard to guarantee.
  • Three scalability directions: size, geography, administration.
  • Three fundamental models: interaction, failure, security.
  • Enslow's three axes: hardware, control, data.
  • Three families: grid is heterogeneous, cluster is homogeneous, cloud is on demand.

Chapter 2 · 7 hours · about 22 marks a paper · in all 22 sittings, the heaviest chapter by far

Distributed objects and file system

How one machine makes another machine do work (RPC and RMI), and how many machines pretend to be one disk (DFS, NFS, HDFS) and one phone book (name services and DNS). This is the longest chapter in the syllabus and the heaviest in the paper: two questions come from here in almost every sitting.

What this chapter is about
  • Calling across the network: RPC calls a remote procedure, RMI invokes a method on a remote object. Same idea, different vocabulary, and the paper always wants the difference.
  • Invocation semantics: what "the call happened" means when messages get lost. Maybe, at least once, at most once.
  • Distributed file systems: the three module architecture, Sun NFS, and the modern HDFS the syllabus names.
  • Stateful against stateless: whether the server remembers you between calls. Asked nearly every year.
  • Naming: why names exist at all, and how DNS answers a query by walking a hierarchy.
Where it fits
  • RMI is the mechanism CORBA uses in chapter 4, so learn the layers here and chapter 4 becomes a naming exercise.
  • Invocation semantics return in chapter 9, where reliable client server communication is exactly this problem under a failure model.
  • File replication here is the small version of chapter 7.
What you will learn
  1. 2.1 Distributed objects and remote object references
  2. 2.2 Communication between distributed objects, and invocation semantics
  3. 2.3 Remote procedure call and how it works
  4. 2.4 RPC against RMI
  5. 2.5 RMI software: proxy, dispatcher, skeleton and the registry
  6. 2.6 Events and notifications
  7. 2.7 Distributed file systems: what and why
  8. 2.8 Stateful against stateless service
  9. 2.9 File service architecture
  10. 2.10 Sun Network File System
  11. 2.11 Andrew File System
  12. 2.12 HDFS, the modern distributed file system
  13. 2.13 MapReduce
  14. 2.14 Name services
  15. 2.15 DNS
  16. 2.16 Directory and discovery services
  17. 2.17 Comparing the file systems
  18. 2.18 Last minute recall, chapter 2
How it is examined
  • Two questions, sometimes three. Typically Q2 on objects, RPC or RMI and Q3 on the file system or DNS.
  • The pairings repeat: "stateful and stateless, then explain any one modern DFS"; "define distributed object and IDL, then compare RPC and RMI"; "why naming, then DNS".
  • Always draw. RMI, the file service architecture, NFS and DNS all have a standard diagram, and a marker looks for it.

2.1Distributed objects

Objects that live in another process HOT 7/22

80 Bh · 79 Bh · 76 Ash · 74 Ash · 72 Ka · 71 Shr · 69 Ch3+52+42+6

Distributed object An object, in the object oriented sense, whose instances are distributed across different address spaces, on several computers in a network or in several processes on one computer, and which work together by sharing data and invoking each other's methods.

Why bother. A programmer already knows how to call a method. If a remote object can be called with the same syntax as a local one, then the whole apparatus of the network, the sockets, the byte order, the retries, disappears behind a familiar line of code. That is location transparency applied to objects: the remote object and the local object look alike inside the calling program.

Lecture note figure: three process ovals, object A in the first invoking object B in the second remotely, objects C, D and E invoking each other locally inside that process, and B invoking object F in a third process remotely
Local and remote invocation. Inside one process, C invokes E locally because it holds an ordinary reference. Across processes, A invokes B and B invokes F, and each needs a remote object reference to do it. From the Chapter 2 lecture notes

The three terms the paper asks for, and they are separate things:

  • Remote object: an object that can receive remote invocations. Ordinary objects can receive only local invocations, from other objects in the same process that hold a reference to them.
  • Remote object reference: the identifier that lets an object in another process reach a remote object. Without it there is no way to name the target. A reference can be passed on, which is how A in the figure obtains the reference to F through B.
  • Remote interface: the interface a remote object publishes, stating which of its methods may be invoked from another process. Methods outside the remote interface stay private to the process.
IDL An Interface Definition Language specifies a remote interface in a language neutral way: the method names, their parameter types, the return types and the exceptions. It must be complete and implementation neutral, so a client written in one language can call a server written in another.

What IDL buys, in one line: it is the contract that makes heterogeneity survivable. Sun RPC calls its IDL XDR, CORBA calls its own CORBA IDL, and Java RMI uses Java interfaces instead, which is why Java RMI works only between Java programs.

Two consequences worth a mark each. First, a chain of invocations may cross several processes, so an action started in one place can end up executing in four. Second, distributed garbage collection becomes necessary: a remote object must not be collected while some far away process still holds a reference, so RMI adds a module that counts remote references and cooperates with each machine's local collector.

Asked on the paper, word for word
  • Define distributed object and IDL. How RPC operation is performed in client server communication in distributed system. 2080 Bhadra Q2 · 2+6
  • Define distributed object and remote interface. How RMI helps in distributed programming model? Explain with architecture. 2079 Bhadra Q3 · 4+5
  • Define distributed objects and explain communication between distributed system. 2076 Ashwin Q2 · 8
  • Define distributed object and IDL. Compare RPC and RMI architecture. 2074 Ashwin Q2 · 3+5
  • Mention the role of IDL and middleware in Distributed System. Explain RMI approach in the distributed object based system. 2072 Kartik Q2 · 4+6
  • What is the importance of IDL in RMI? Write the operation of static RMI. 2071 Shrawan Q2 · 3+5
  • What is IDL? Explain CORBA RMI with its services. 2069 Chaitra Q11 · 2+4

2.2Communication between distributed objects

RMI, the request reply protocol, and invocation semantics HOT 5/22

81 Bh · 80 Bh · 76 Ash · 71 Ch · 70 Asa2+63+54+4

Remote method invocation The means by which an object in one process invokes a method of an object in another process, on the same computer or on a different one. An invocation between objects in the same process is a local method invocation.

Underneath, every RMI is a request reply exchange. The client sends a request message naming the object and the method, and the server sends a reply carrying the result. The message carries five fields, and a question that says "message structure" wants exactly these:

  • messageType: an integer, 0 for a request and 1 for a reply.
  • requestId: an integer, so a reply can be matched to its request and a duplicate can be recognised.
  • objectReference: which remote object is being invoked.
  • methodId: which method of it.
  • arguments: an array of bytes, the marshalled parameters.

Now the interesting part. A local call runs exactly once: the machine either runs the method or crashes with it. A remote call has a network in the middle, so the request can be lost, the reply can be lost, or the server can crash halfway. What the caller is promised depends on which three fault tolerance measures the implementation uses:

  • Retry request message: retransmit the request until either a reply arrives or the server is assumed to have failed.
  • Duplicate filtering: the server recognises retransmitted requests by their request id and does not execute them twice.
  • Retransmission of results: the server keeps a history of replies, so a lost reply can be resent without re-executing the method.
Lecture note table: the three invocation semantics against their fault tolerance measures, maybe with no retransmission, at least once with retransmission and re-execution, and at most once with retransmission, duplicate filtering and a retransmitted reply
The table to reproduce. Three measures, three semantics. Learn it as rows, not as prose: the examiner is looking for which measures each semantics uses. From the Chapter 2 lecture notes
  • Maybe semantics: no fault tolerance measures at all. The method may be executed once or not at all, and the caller cannot tell which. It suffers omission failure when a message is lost and crash failure when the server dies. Acceptable only when an occasional failed call does not matter.
  • At least once semantics: retry, but no duplicate filtering, so the procedure is re-executed on every retransmission. The caller either gets a result, meaning the method ran at least once, or an exception. It suffers crash failures and arbitrary failures, because a method executed twice may return a wrong value. It is safe only for idempotent operations, those that give the same result however often they run.
  • At most once semantics: retry, duplicate filtering and retransmission of results together. The caller either receives the result of exactly one execution, or an exception. This is the strongest an RMI system offers, and it is what Java RMI and CORBA provide.

RMI transparency is the hiding of marshalling, message passing, and the work of locating and contacting the remote object, so that a remote invocation looks like a local one. It is deliberately incomplete: the semantics above differ from a local call, and the remote interface must declare the extra exceptions, so the programmer is warned that this call can fail in ways a local call cannot.

Asked on the paper, word for word
  • Define local and remote method invocation in distributed system. Explain the functional steps taken by modern RPC with its communication semantics. 2081 Bhadra Q2 · 3+5
  • What is RMI? Explain CORBA architecture in Distributed System along with services. 2080 Bhadra Q4 · 2+6
  • Define distributed objects and explain communication between distributed system. 2076 Ashwin Q2 · 8
  • Define DFS. How RMI perform communication between distributed objects? Explain. 2071 Chaitra Q2 · 2+6
  • Explain the ways how distributed objects communicate with each other. Differentiate between RPC and RMI. 2070 Ashad Q2 · 4+4

2.3Remote procedure call

RPC: the ten steps, and Sun RPC as the case study TOP 8/22

81 Bh · 81 Ba · 80 Bh · 76 Ash · 71 Shr · 70 Ch · 69 Ch · 67 Mng2+63+54

Remote procedure call A communication mechanism in which a client program calls a procedure in another program running in a server process, as if it were a local procedure call. The server publishes a service interface defining the procedures available for remote calling.

How RPC differs from RMI, in the two ways that matter: RPC has no object references, so you call a procedure by name and number rather than a method on a particular object, and it cannot create new instances of objects. Otherwise it uses the same request reply protocol and the same three invocation semantics.

Lecture note figure: the ten functional steps of a remote procedure call, client functions down to client stub to network routines, across the network to the server's network routines, server stub and server functions, and the reply back along the same path
The ten functional steps. This is the diagram to draw whenever a question says "explain the operation of RPC". The numbers are the order to narrate. From the Chapter 2 lecture notes

The working of RPC, step by step, which is worth five or six marks on its own:

  1. The client procedure calls the client stub in the normal way, as an ordinary local call.
  2. The client stub builds the message, packing the procedure identifier and the arguments, and calls the local operating system.
  3. The client's OS sends the message to the remote OS.
  4. The remote OS gives the message to the server stub.
  5. The server stub unpacks the parameters and calls the server procedure.
  6. The server does the work and returns the result to its stub.
  7. The server stub packs the result in a message and calls the local OS.
  8. The server's OS sends the message to the client's OS.
  9. The client's OS gives the message to the client stub.
  10. The client stub unpacks the result and returns it to the client, which never knew it had left the machine.

What a stub actually does is marshalling: turning the arguments, which are machine specific bit patterns, into an agreed external representation that any machine can read, and back again at the other end. That is the step that makes heterogeneity survivable, and it is the step that costs the time.

Case study: Sun RPC

Sun RPC was designed for client server communication in the Sun Network File System, which is why it turns up again in section 2.10. Its features:

  • Transport: runs over UDP or TCP. Over UDP the request and reply lengths are restricted, in theory to 64 kilobytes.
  • Semantics: at least once, which is why NFS operations are designed to be idempotent.
  • Interface language: XDR, with an interface compiler rpcgen used with C.
Lecture note figure: a Sun XDR interface definition listing the Data, writeargs and readargs structures and the FILEREADWRITE program numbered 9999 with WRITE as procedure 1 and READ as procedure 2
An XDR interface. Note what identifies things: a program number (9999), a version number and a procedure number (WRITE is 1, READ is 2), rather than an interface name. From the Chapter 2 lecture notes

The XDR rules examiners ask about:

  • It supplies a program number and version number instead of an interface name. The version number changes when a procedure changes, and both are sent in the request so client and server can confirm they agree.
  • A procedure definition is a procedure signature plus a procedure number, and the number is what the request carries.
  • Only a single input parameter is allowed. Several inputs must be wrapped in a structure.
  • The outputs are returned as a single result.
  • rpcgen generates the client stub, the server main procedure, dispatcher and server stub, and the marshalling and unmarshalling procedures, all from the interface definition.

Binding: how the client finds the server's port. A local binding service called the port mapper runs at a well known port on each computer. Each port mapper records the program number, version number and port number of every service on its machine. When a server starts, it registers its program number, version number and port with the local port mapper. When a client starts, it makes a remote request to the port mapper on the server's host, giving the program and version numbers, and gets back the port.

Authentication. Sun RPC messages carry an extra field for authentication information, which matters for critical operations such as reaching the network file system. The header names the style in use, and the supported styles are none, UNIX style, shared key and Kerberos style.

Asked on the paper, word for word
  • Define local and remote method invocation in distributed system. Explain the functional steps taken by modern RPC with its communication semantics. 2081 Bhadra Q2 · 3+5
  • What do you mean by Request Replay Protocol? Discuss how dynamic RMI works. 2081 Baishakh Q2 · 2+8
  • Define distributed object and IDL. How RPC operation is performed in client server communication in distributed system. 2080 Bhadra Q2 · 2+6
  • Write short notes on any two: RPC 2076 Ashwin Q10a · 4
  • Write short notes on (Any Three): RPC communication semantics 2071 Shrawan Q9e · 4
  • Differentiate between RPC and RMI. How does modern RPC maintain the transparency in distributed system? 2070 Chaitra Q3 · 2+6
  • How do you convince that middleware plays the important role in Distributed System? Explain the operation of RPC in client server communication in Distributed System. 2069 Chaitra Q2 · 3+5
  • Discuss the problems associated with parameter passing in RPC. Explain with diagram different alternatives of asynchronous RPC. 2067 Mangsir Q7 · 6+4
In the exam
  • "Functional steps of modern RPC" means the ten steps plus the semantics. Draw the stub diagram first, then number the steps against it.
  • Parameter passing problems (asked in 2067 Mangsir) are: pointers cannot be passed because address spaces differ, complex structures must be flattened, and machines differ in byte order and data sizes. The answer is copy in copy out plus an agreed external representation.

2.4RPC against RMI

The comparison the paper asks for every other year HOT 6/22

78 Bh · 75 Ch · 74 Ash · 72 Ch · 70 Ch · 70 Asa3+54+42+6

This is asked as "differentiate", "compare" and "how is RMI superior to RPC". One table answers all three, and the last row is the one that earns the "superior" mark.

PointRPCRMI
ParadigmProcedural: calls a procedureObject oriented: invokes a method on an object
What is namedA procedure, by program, version and procedure numberAn object, by a remote object reference, then a method
Object referencesNone, so objects cannot be passed or returnedRemote object references are first class and can be passed as parameters
Creating instancesCannot create new objectsCan create remote objects through a factory
ParametersOrdinary data structures, passed by valueObjects, passed by value or by reference
InterfaceA service interface in an IDL such as XDRA remote interface, in Java RMI an ordinary Java interface
LanguageLanguage neutral through the IDLJava RMI is Java only; CORBA restores neutrality with its IDL
Typical semanticsMaybe or at least once, as configuredAt most once by default

Why RMI is called superior: it keeps the object model across the network. Because a remote object reference can be passed as a parameter and returned as a result, a program can build and traverse a structure of remote objects, which RPC cannot express at all. It also inherits the object oriented advantages of encapsulation, inheritance and polymorphism, and it gives at most once semantics without the programmer arranging it.

The three differences to lead with, if the question is only worth two marks:

  • RPC calls a procedure; RMI invokes a method on an object.
  • RPC has no object references, so objects cannot be passed or returned.
  • RMI gives at most once semantics by default, where RPC is usually configured for maybe or at least once.
Lecture slide: a remote procedure call drawn with the client calling the client stub, which marshals arguments through the communication and remote reference modules, and the server stub unmarshalling them for the server, with the reply returning the same way
RPC drawn the same way as RMI. Compare this with the RMI diagram in 2.5: the client stub and server stub sit exactly where the proxy and skeleton sit, which is the point. Marshalling happens in the shaded halves. From the Chapter 2.1 lecture slides, Petru Eles, IDA, LiTH
Asked on the paper, word for word
  • Elaborate the differences between RMI and RPC. Describe the File Service Architecture of DFS. 2078 Bhadra Q2 · 4+4
  • What do you mean by RMI software? Comparatively discuss RPC with RMI. 2075 Chaitra Q2 · 3+5
  • Define distributed object and IDL. Compare RPC and RMI architecture. 2074 Ashwin Q2 · 3+5
  • Explain RMI with suitable diagram. How RMI is superior to RPC? 2072 Chaitra Q3 · 8+2
  • Differentiate between RPC and RMI. How does modern RPC maintain the transparency in distributed system? 2070 Chaitra Q3 · 2+6
  • Explain the ways how distributed objects communicate with each other. Differentiate between RPC and RMI. 2070 Ashad Q2 · 4+4

2.5RMI software

Proxy, dispatcher, skeleton, and the two modules under them TOP 8/22

81 Ba · 80 Ba · 79 Bh · 76 Ch · 75 Ch · 72 Ch · 72 Ka · 71 Shr3+52+62+8

"Functionalities provided by RMI software" is a standing question. RMI software is the layer between the application objects and the request reply protocol, and it is made of three generated classes and two modules.

Lecture slide: the implementation of RMI, object A on the client calling the proxy for B which marshals the arguments and passes them to the communication module and remote reference module, across the network to the server's modules and the skeleton for B, which unmarshals and invokes object B
The RMI layers. Object A calls the proxy for B, which marshals and hands down to the communication module; on the server the skeleton unmarshals and invokes the real object B. Redraw this for any "explain RMI with architecture" question. From the Chapter 2.1 lecture slides, Petru Eles, IDA, LiTH

The three generated classes, each with one job:

  • Proxy (client side). One proxy object per remote object the client uses. It implements the same remote interface, so the client's code calls it exactly as if it were the remote object. Its method bodies marshal the arguments, send the request, wait, unmarshal the result and return it. The client never knows it exists.
  • Dispatcher (server side). One per class of remote object. It receives the request message, reads the methodId and calls the matching method of the skeleton.
  • Skeleton (server side). One per class of remote object. It unmarshals the arguments, invokes the method on the real object, which is called the servant, then marshals the result and sends the reply.

The two modules underneath, which are not generated and are shared by everything:

  • Communication module: carries out the request reply protocol. It pairs a reply with its request by request id, applies the chosen invocation semantics, and hands an incoming request to the right dispatcher.
  • Remote reference module: translates between local object references and remote object references, using a remote object table that records every remote object held by this process and every proxy it holds for remote objects elsewhere. It is what creates a proxy the first time a remote reference arrives from outside.

The binder, and static against dynamic RMI

A client still has to obtain that first remote reference, and it does so from a binder: a service that maps textual names to remote object references. In Java this is the RMI registry: the server calls bind or rebind to register a name, the client calls lookup to get back a proxy.

  • Static RMI: the remote interface is known when the client is compiled, so the proxy and skeleton classes are generated ahead of time and the call is checked by the compiler. It is fast and safe, and it cannot call anything the programmer did not know about.
  • Dynamic RMI: the interface is discovered at run time. The client asks an interface repository what methods the object offers, builds the invocation as data, and sends it. It is slower and unchecked, and it can call a service that did not exist when the client was written. CORBA calls these two the static and dynamic invocation interfaces.

Two extra services the RMI software may provide, and papers do ask for them: an activation service, which restarts a remote object on demand so servers need not run forever, and distributed garbage collection, which keeps a remote object alive while any proxy anywhere still refers to it.

The request reply protocol under all of this is the one in 2.2, and the same layering reappears as the ORB in chapter 4.

Asked on the paper, word for word
  • What do you mean by Request Replay Protocol? Discuss how dynamic RMI works. 2081 Baishakh Q2 · 2+8
  • Explain the role of middleware in Distributed System. Explain the operation of dynamic RMI. 2080 Baishakh Q2 · 2+6
  • Define distributed object and remote interface. How RMI helps in distributed programming model? Explain with architecture. 2079 Bhadra Q3 · 4+5
  • Discuss the functionalities provided by RMI software. How is the event and notification system implemented in distributed object based communication? 2076 Chaitra Q2 · 3+5
  • What do you mean by RMI software? Comparatively discuss RPC with RMI. 2075 Chaitra Q2 · 3+5
  • Explain RMI with suitable diagram. How RMI is superior to RPC? 2072 Chaitra Q3 · 8+2
  • Mention the role of IDL and middleware in Distributed System. Explain RMI approach in the distributed object based system. 2072 Kartik Q2 · 4+6
  • What is the importance of IDL in RMI? Write the operation of static RMI. 2071 Shrawan Q2 · 3+5

2.6Events and notifications

When the server has to speak first PIN 1/22

76 Ch3+5

RMI has one weakness: the client must ask. If a client wants to know when something happens, it has to keep asking, which is wasteful and slow. The event and notification model inverts the flow: objects announce that something happened, and whoever cares is told.

Distributed event based system A system in which an object of interest publishes an event when its state changes, and each subscriber that has registered interest receives a notification. Publishers and subscribers do not know each other.

The participants, which is what a question wants listed:

  • Object of interest: the object whose change of state causes the event, for example a share price or a room's door sensor.
  • Event: the occurrence itself, carrying the attributes that describe it.
  • Notification: the message that reports the event to a subscriber.
  • Subscriber: an object that has registered interest in some class of events.
  • Observer or event service: the intermediary that decouples the two. It takes the publisher's notifications, applies the subscribers' filters, and forwards what matches.
  • Publisher: the object that generates the notification, which is usually the object of interest or its observer.

What the intermediary is for. Without it, a publisher would have to keep a list of every interested party, which is exactly the coupling the model is trying to avoid. With it, the publisher emits one notification and the event service handles the fan out, the filtering (only the events matching a subscriber's pattern), the queueing for subscribers that are offline, and the security.

Two properties worth naming because they are the reason to choose this model: heterogeneity, since a publisher and a subscriber need nothing in common but the event format, and asynchrony, since notifications are sent without the publisher waiting, so neither side blocks on the other.

The Jini distributed event specification is the standard case study, and it fits with chapter 10: an object registers interest with an event generator, the generator sends a remote event object to the listener's notify method, and third party agents may be interposed to store, filter or forward notifications on a subscriber's behalf.

Asked on the paper, word for word
  • Discuss the functionalities provided by RMI software. How is the event and notification system implemented in distributed object based communication? 2076 Chaitra Q2 · 3+5

2.7Distributed file systems

What a DFS is, and the requirements it must meet TOP 9/22

79 Bh · 76 Ch · 76 Ash · 73 Shr · 72 Ch · 72 Ka · 71 Ch · 70 Ch · 70 Asa2+682+3+2

Distributed file system A file system distributed across multiple machines, which lets programs store and access remote files exactly as they do local ones, so that users can reach their files from any computer on the network.

Start from the plain file system. A file system gives an abstract view of secondary storage and is responsible for global naming, file access and overall file organisation. Those three jobs are handled by the name service, the file service and the directory service. Two terms the paper separates: the file service is the specification of what the file system offers its clients, and a file server is a process on some machine that implements it.

Why a distributed one matters, which answers "how does DFS encourage sharing a storage device":

  • It supports sharing of information as files across the whole intranet, so one copy of a document serves everybody instead of a copy per machine.
  • It lets programs store and access remote files exactly as local ones, so no application has to be rewritten to use shared storage.
  • It separates the storage from the workstation, so an expensive, backed up, managed disk array serves many cheap diskless clients, which is the economic argument.

The requirements of a DFS, the standard seven point list:

  • Transparency of access, location, mobility (migration), performance and scaling. Access and location transparency together give network transparency.
  • Concurrent file updates must be controlled, so that simultaneous writers do not corrupt a file.
  • File replication must be supported, to raise scalability and fault tolerance.
  • Hardware and operating system heterogeneity: the service interfaces must be definable so they can be implemented on different systems.
  • Fault tolerance: the service must continue to operate through client or server failures.
  • Consistency: files must keep a consistent state, which in UNIX means one copy update semantics.
  • Security: access control mechanisms must protect the files.

Two more that are always accepted: efficiency, since the DFS must perform comparably with a local file system, and naming, since users need one global name structure rather than a different path on every machine.

Asked on the paper, word for word
  • What is recursive and iterative query? Describe working mechanism of DNS with suitable example. Mention the role of distributed file system. 2079 Bhadra Q2 · 2+3+2
  • What is distributed file system? Explain the principle operations of any one modern distributed file system? 2076 Chaitra Q3 · 2+7
  • Define Distributed file system. Point out the differences between stateless and stateful services. 2076 Ashwin Q3 · 8
  • What are the requirements of Distributed File System? Describe file service architecture for Distributed File System. 2073 Shrawan Q2 · 4+4
  • Discuss the importance of Distributed File System (DFS). Describe the operations of SUNNFS with its properties. 2072 Chaitra Q2 · 2+6
  • Define DFS. How does DFS encourage sharing a storage device? Explain with the help of suitable architecture. 2072 Kartik Q3 · 8
  • Define DFS. How RMI perform communication between distributed objects? Explain. 2071 Chaitra Q2 · 2+6
  • Draw and explain distributed file service architecture. How does that architecture encourage the sharing of storage resources in distributed system? Explain. 2070 Chaitra Q2 · 6+2
  • Define distributed file system. Draw and explain distributed file service architecture in detail. 2070 Ashad Q3 · 2+6

2.8Stateful against stateless service

Does the server remember you between calls? HOT 6/22

81 Bh · 80 Bh · 80 Ba · 76 Ash · 75 Ch · 74 Ash2+63+54

This is asked in six of the twenty two sittings, usually as the two mark opener before a file system question. Get the definitions exact, then give the trade off.

Stateful service The server keeps track of information about client requests between calls: which files a client has opened, its connection identifiers and its cached state.
Stateless service The server keeps nothing between calls, so every client request must be self contained, carrying all the information the server needs, such as the file name and the offset in it.
PointStatefulStateless
RequestShort: a connection identifier stands for the open fileLonger: must repeat the file identifier and the offset every time
PerformanceBetter: the file name is parsed once at open, and the server can read aheadWorse: every request is parsed and located afresh
Server crashDisastrous: all the state is lost and clients must rebuild itHarmless: the client simply retries, since nothing was remembered
Client crashThe server must detect it and reclaim memory and locksNothing to reclaim
MemoryGrows with the number of open files and clientsConstant
Operationsopen and close are meaningfulopen and close are not needed, and operations should be idempotent
ConsistencyEasier: the server knows who has what openHarder: file locking and consistency need a separate service

The three points that decide it, if the question is worth only two marks:

  • Stateful is faster, because the file name is parsed once and the server can read ahead.
  • Stateless recovers instantly, because a restarted server has nothing to rebuild.
  • Stateless needs idempotent operations, since every request may be retried.

Advantages and consequences of statelessness, which is a short note in its own right: it gives fast crash recovery, since a restarted server needs no recovery protocol and a client cannot tell a slow server from a crashed one; it makes the server simple and its memory bounded; and the cost is larger request messages, worse performance, and the loss of server side locking, which is why NFS needs a separate lock manager. Sun NFS chose stateless for exactly this reason: fast crash recovery was the design goal.

Asked on the paper, word for word
  • What is the difference between stateful and stateless distributed file system? Discuss the working principle of any one modern Distributed File System with its architecture. 2081 Bhadra Q3 · 2+6
  • Write short notes on: Advantages and consequences of statelessness in DFS 2080 Bhadra Q10c · 4
  • Compare stasteful and stateless services. Explain the operation and architecture of any one modern distributed file system. 2080 Baishakh Q3 · 3+5
  • Define Distributed file system. Point out the differences between stateless and stateful services. 2076 Ashwin Q3 · 8
  • Compare Stateful and stateless service. Describe the architecture and operation of SUNNFS with its services. 2075 Chaitra Q3 · 2+6
  • What is stateful and stateless service in file system? Explain the DNS working mechanism with suitable practical example. 2074 Ashwin Q3 · 3+5

2.9File service architecture

Three modules, and what each one owns HOT 7/22

80 Bh · 78 Bh · 73 Shr · 72 Ka · 70 Ch · 70 Asa · 69 Ch4+42+63+5

This is the diagram behind "draw and explain distributed file service architecture", worth four to six marks in six different sittings. The design exists so that the three jobs of a file system can be implemented separately, and so that the server modules can be stateless.

Lecture note figure: the file service architecture, a client computer holding application programs and the client module, joined across the network to a server computer holding the directory service above the flat file service and its disks
The three modules. Client module on the client; flat file service and directory service on the server. The directory service is a client of the flat file service, since directories are themselves files. From the Chapter 2 lecture notes
  • Flat file service. Implements operations on the contents of files. It knows nothing about names: files are identified by a Unique File Identifier, a long bit string unique across the whole distributed system. Operations: Read, Write, Create, Delete, GetAttributes, SetAttributes. Read and Write take the position explicitly, which is what makes the service stateless.
  • Directory service. Provides the mapping between text names for files and their UFIDs, and is therefore the thing that turns a path into a file. Operations: Lookup, AddName, UnName, GetNames. A directory is stored as an ordinary file in the flat file service, so a hierarchy is built by directories naming directories.
  • Client module. Runs on each client computer and integrates and extends the two server services behind a single application programming interface, so an ordinary program sees a normal file system. It holds the state that the stateless server does not: the current directory, the open files and their positions, and the server addresses. It also caches recently used blocks, which is where the performance comes from.

Why split it this way? Because the two responsibilities scale differently and fail differently. Keeping names out of the flat file service lets the same file be named in several directories, lets the file service stay stateless, and lets a UFID be checked for access rights independently of the path used to reach it.

Asked on the paper, word for word
  • Explain file service architecture for DFS. Define queries and operation of distributed hierarchical DB: DNS. 2080 Bhadra Q3 · 4+4
  • Elaborate the differences between RMI and RPC. Describe the File Service Architecture of DFS. 2078 Bhadra Q2 · 4+4
  • What are the requirements of Distributed File System? Describe file service architecture for Distributed File System. 2073 Shrawan Q2 · 4+4
  • Define DFS. How does DFS encourage sharing a storage device? Explain with the help of suitable architecture. 2072 Kartik Q3 · 8
  • Draw and explain distributed file service architecture. How does that architecture encourage the sharing of storage resources in distributed system? Explain. 2070 Chaitra Q2 · 6+2
  • Define distributed file system. Draw and explain distributed file service architecture in detail. 2070 Ashad Q3 · 2+6
  • What do you mean by file and directory service? Explain the operation of SUN NFS with its architecture. 2069 Chaitra Q3 · 3+5

2.10Sun Network File System

NFS: the architecture, the protocol and the mount TOP 10/22

81 Bh · 81 Ba · 80 Ba · 78 Bh · 76 Ch · 75 Ch · 75 Ash · 72 Ch · 71 Shr · 69 Ch2+63+52+7

NFS is the single most asked topic in chapter 2. "Explain the operation and architecture of any one modern distributed file system" almost always means this.

What it is: the first commercially successful network file system, developed by Sun Microsystems for their diskless workstations, designed for robustness, adequate performance and transparent access, with the protocol specification published so that many implementations exist.

The six properties the lecture notes list, which is the list to reproduce:

  • It is both an implementation and a specification of how to access remote files.
  • It focuses on sharing a file system in a transparent way.
  • It uses the client server model, and a node can act as both client and server.
  • It uses mount to make a server file system visible from a client.
  • It is stateless: all client requests must be self contained.
  • It is machine and operating system independent.
Lecture note figure: the NFS architecture, application programs making UNIX system calls into the virtual file system of the client kernel, which routes local requests to the UNIX file system and remote requests through the NFS client over the NFS protocol to the NFS server on the server computer
The NFS architecture. The virtual file system is the whole trick: it sits under the ordinary system calls and decides, per file, whether the request goes to the local UNIX file system or out through the NFS client. From the Chapter 2 lecture notes

The architecture in three parts, which is how the answer should be organised:

  • 1. The protocol. Built on the Sun RPC mechanism and the XDR standard for representing data. It is stateless, which is what makes crash recovery easy: every procedure call carries all the information needed to complete it, so a server that restarts simply starts answering again.
  • 2. The server side. The server issues a file handle for each file, made of three parts: the file system identifier, which names the disk partition and is stored in its super block; the i-node number, which names the file within that partition; and the generation number, stored in the i-node and incremented when the i-node is reused, so a stale handle to a deleted file is rejected rather than silently pointing at a new one.
  • 3. The client side. Presents a transparent interface to NFS through the virtual file system, which keeps a v-node per open file recording whether it is local or remote. The mapping from a remote file name to a remote file address is set up at boot time through a remote mount.

The mount operation, since a question may ask how the remote file system appears: the client sends a mount request naming a remote directory, the server's mount service checks its export list and returns the file handle for that directory, and the client grafts it onto a point in its own local name space. From then on any path below that point is resolved through the NFS client. Hard mounting makes a process block until the server answers; soft mounting returns an error after a few retries.

The operations NFS offers fall into five groups: search for a file within a directory; read a set of directory entries; manipulate links and directories; read and write file attributes; and read and write file data.

Design issues on NFS, which is its own question (2078 Bhadra): the statelessness forces every request to carry the offset and makes UNIX open and close semantics hard to reproduce; caching at the client gives the performance but creates a consistency problem, solved only approximately by validating cached blocks against the file's modification time on a timer; locking is not in the protocol and needs a separate lock manager, which is stateful; and security rests on the UNIX user id in the RPC credentials, which the server has to trust.

Asked on the paper, word for word
  • What is the difference between stateful and stateless distributed file system? Discuss the working principle of any one modern Distributed File System with its architecture. 2081 Bhadra Q3 · 2+6
  • Explain the principle operation with architecture of recently used distributed file system. 2081 Baishakh Q3 · 10
  • Compare stasteful and stateless services. Explain the operation and architecture of any one modern distributed file system. 2080 Baishakh Q3 · 3+5
  • What are the design issues on NFS? Show the complete working of DNS. 2078 Bhadra Q4 · 4+4
  • What is distributed file system? Explain the principle operations of any one modern distributed file system? 2076 Chaitra Q3 · 2+7
  • Compare Stateful and stateless service. Describe the architecture and operation of SUNNFS with its services. 2075 Chaitra Q3 · 2+6
  • Why naming is necessary in distributed system? Explain Sun Network File System architecture with its features. 2075 Ashwin Q2 · 2+6
  • Discuss the importance of Distributed File System (DFS). Describe the operations of SUNNFS with its properties. 2072 Chaitra Q2 · 2+6
  • What are the characteristics of SUN-NFS? Discuss with its architecture. 2071 Shrawan Q3 · 3+5
  • What do you mean by file and directory service? Explain the operation of SUN NFS with its architecture. 2069 Chaitra Q3 · 3+5

2.11Andrew File System

AFS: cache the whole file, and be told when it changes

AFS is in the deck as the contrast to NFS, and it is worth knowing because it answers "why would anyone not do what NFS does".

  • Whole file serving. When a client opens a file, AFS transfers the entire file to the client's local disk, not block by block. Reads and writes then happen locally at local speed, and the file is written back when it is closed.
  • Whole file caching on disk. The copy stays in the client's local cache after the close, so opening it again usually needs no network traffic at all. This is why AFS scales to far more clients per server than NFS.
  • Callback promise. The server records which clients hold a copy and promises to tell them when the file changes. A cached copy is therefore valid until a callback arrives, and no validation traffic is needed. This makes the AFS server stateful, the opposite choice to NFS.
  • Session semantics. Updates are visible to other clients only after the file is closed, unlike NFS which aims at one copy semantics.
  • Location independence and mobility. The AFS name space is one global tree, the same on every client, and volumes can be moved between servers without changing any name.

The two components to name: Vice, the server process, and Venus, the client process that intercepts open and close and manages the cache. AFS suits files that are read many times and written rarely, and it suits large files badly, since the whole file must move before the first byte can be read.

2.12HDFS

HDFS: one master, many block servers PIN 3/22

68 Ch · 68 Ba · 67 Mng586+4

The syllabus names HDFS in 2.8, and three older sittings asked the same design under its ancestor's name, GFS. The architecture is the same and so are the answers: a single master holding metadata, many slaves holding fixed size blocks, and replication for reliability.

HDFS A distributed file system designed to run on commodity hardware, in which files are broken into blocks of 128 MB, each block is replicated on several machines, and a single master keeps all the metadata while the data never passes through it.
Lecture slide: the HDFS architecture, a single namenode holding the metadata, clients issuing read and write operations, and datanodes holding blocks arranged in two racks with replication between them
Master and slaves. Metadata operations go to the namenode; the actual bytes go straight between the client and the datanodes. That separation is what lets one master serve a huge cluster. From the Chapter 2 HDFS lecture slides

The two roles, which every HDFS question starts from:

  • NameNode, the master. It maintains the namespace tree, the hierarchy of files and directories, and handles opening, closing and renaming. It determines the mapping of file blocks to DataNodes, holds the file metadata, does authorisation and authentication, collects block reports, and orders missing blocks to be replicated. It keeps the entire namespace in RAM, which is what makes metadata access fast and what bounds the number of files a cluster can hold.
  • DataNodes, the slaves. They serve read and write requests directly from clients, and they create, delete and replicate blocks on the NameNode's instruction. They periodically send block reports to the NameNode.
Lecture slide: HDFS block replication, the namenode holding for each file the number of replicas and the list of block ids, and the datanodes below each holding a different subset of the numbered blocks
What the metadata actually is. For each file the namenode stores the replication factor and the ordered list of block ids; each datanode holds some subset of those blocks. Nothing here says where permanently: that comes from block reports. From the Chapter 2 HDFS lecture slides

Why the master is not overloaded, which is a question in its own right (2068 Chaitra). Four design decisions keep one machine sufficient:

  • The master never touches the data. A client asks it only for block locations, then talks to the datanodes directly, so the master's traffic is tiny compared with the file traffic.
  • Blocks are large (128 MB), so a huge file needs only a handful of metadata entries and a client needs only a few master interactions per file.
  • Metadata lives in memory, so a request costs no disk access.
  • Block locations are not persisted. The master does not store which datanode holds which block on disk: it rebuilds that map from the block reports the datanodes send when they start and periodically after. This avoids keeping master and datanodes in sync, and it is correct by construction, because the datanode is the authority on what it holds.

Heartbeats and block reports are how the master learns anything. A datanode sends a heartbeat every three seconds to say it is alive and its replicas are available, and every tenth heartbeat is a block report listing the block id, generation stamp and length of every replica it holds. The master never calls a datanode: it piggybacks instructions on the replies to heartbeats, telling a node to replicate a block, remove a local replica, or re-register.

Lecture slide: re-replicating missing replicas, a dead data node detected by missing heartbeats, the name node consulting its metadata and the rack awareness script and instructing a surviving data node to copy the affected blocks
Re-replication. Missing heartbeats mean a lost node, so the namenode finds the affected blocks in its metadata, consults the rack awareness script, and instructs a surviving node to copy them. The replication factor is restored without a human. From the Chapter 2 HDFS lecture slides

The pipelined write, which is the "control flow of a write mutation" question:

Lecture slide: a pipelined write in HDFS, the client sending the block to the first data node, which passes it along to a second and then a third data node as it is received, with the name node told when the block is received
Writing a block. The client sends to the first datanode only; that node forwards to the second as the bytes arrive, and the second to the third. The client's uplink is used once, and the network cost is spread. From the Chapter 2 HDFS lecture slides
  1. The client asks the NameNode to create the file and to allocate a block.
  2. The NameNode picks a list of DataNodes for the replicas, using rack awareness: two copies in one rack and one in a different rack, so a whole rack can fail without losing the data while most traffic stays inside one rack.
  3. The client sends the block to the first DataNode only.
  4. That node forwards each packet to the second as it receives it, and the second to the third, so the copies are made in a pipeline rather than by the client three times.
  5. Acknowledgements travel back up the pipeline, and each DataNode reports blockReceived to the NameNode.
  6. The client closes the file and the NameNode commits the block to the namespace.
Lecture slide: a client reading files from HDFS, asking the name node for the block locations, receiving the list of data nodes for each block, and reading the blocks in sequence from the nearest data node
Reading. One call to the namenode returns the datanode list for every block; the client then reads each block from the nearest node holding it, in order. From the Chapter 2 HDFS lecture slides

Durability of the metadata, asked as "how does the master survive": the NameNode keeps a journal, the modification log of the metadata, and a checkpoint, the persistent image of the namespace. Two helper roles exist: a CheckpointNode, which periodically merges the journal into a new checkpoint and so keeps the log from growing without bound, and a BackupNode, which holds an up to date in memory image of the namespace and can take over. Snapshots are taken before an upgrade so the cluster can be rolled back.

Lease and consistency, one line each, for the GFS phrasing of the question. The master grants a lease on a block to one primary replica, and that primary alone decides the order of concurrent mutations, so all replicas apply them in the same order without the master being involved in every write. The guarantee is that file namespace mutations are atomic at the master, and that a successful write leaves the region defined: all replicas hold the same bytes and readers see that data.

Asked on the paper, word for word
  • Explain how GFS handles client request? 2068 Chaitra Q2 · 8
  • Why do we have single master in GFS managing millions of chunk servers? What are done to manage it without overloading single master? 2068 Chaitra Q3 · 8
  • Explain the control flow of write mutation with diagram. 2068 Chaitra Q4 · 8
  • Suppose your company got more investment so you can now increase your default replication order by 2 from current value 3 so as to make it your data more available and reliable. Suddenly master has to create two replicas of each file chunks. Yet, it has to satisfy client request which are more important than just replication. How does single master manage re-replication task? 2068 Chaitra Q5 · 8
  • List and explain four main master operations in GFS. 2068 Chaitra Q6 · 4
  • Discuss the single master aspect of GFS architecture. 2068 Baishakh Q4a · 5
  • Enlist GFS metadata. Why chunk locations not persisted by master, discuss it. 2068 Baishakh Q4b · 5
  • Discuss consistency guarantees made by GFS. 2068 Baishakh Q5a · 5
  • Explain the lease mechanism in GFS with examples. 2068 Baishakh Q5b · 5
  • Discuss GFS high availability. 2068 Baishakh Q6a · 5
  • Discuss re-replication and rebalancing role of GFS master. 2068 Baishakh Q6b · 5
  • Discuss assumptions made in GFS design and their consequences. Explain the metadata of GFS? 2067 Mangsir Q3 · 6+4
  • Explain data and control flow and working of lease mechanish in normal write operation of GFS. 2067 Mangsir Q4 · 10

2.13MapReduce

Moving the computation to the data PIN 3/22

68 Ch · 68 Ba · 67 Mng1035

MapReduce was set in the older elective sittings, and it goes naturally beside HDFS. There is no figure for it in the course material, so this card sets it out as the pipeline it is.

MapReduce A programming model in which a computation is expressed as two functions, a map that turns each input record into zero or more key and value pairs, and a reduce that combines all the values sharing a key, while the framework handles the splitting, scheduling, grouping and failure recovery.

The components of a basic job, which is the list a question asks for:

  • Input format and input splits: the input file is divided into splits, normally one per HDFS block, and one map task is started per split.
  • Mapper: reads records from its split and emits intermediate key and value pairs.
  • Combiner (optional): a reducer run locally on a mapper's output, to shrink the data before it crosses the network. It is only valid when the reduce operation is associative and commutative, such as a sum or a maximum.
  • Partitioner: decides which reducer a key goes to, by default hash(key) mod R. Writing a custom partitioner is how you control grouping and output ordering.
  • Shuffle and sort: the framework moves every intermediate pair to its reducer and sorts the pairs by key, so a reducer sees each key once with all its values together.
  • Reducer: receives a key and the list of values for it, and emits the final output.
  • Output format: writes each reducer's output as one file in HDFS.

The data flow, in one line: input file, splits, map, combine, partition, shuffle and sort, reduce, output. That sequence is the diagram if a question demands one.

Where referential transparency comes in, since 2067 Mangsir and 2068 Baishakh both ask it. A function is referentially transparent when its result depends only on its arguments, so a call can be replaced by its value without changing the program. Map and reduce functions are required to be exactly that: no shared state, no dependence on order. Because of it, the framework may run a task on any machine, run it again after a failure, or run a second copy of a slow task (speculative execution) and take whichever finishes first, and the answer is unchanged. Fault tolerance is therefore free: a failed map or reduce task is simply re-run from its input.

NoSQL and why normalization fails in analytics, the other legacy question. A NoSQL store drops the relational model and the fixed schema in favour of key value, document, column family or graph storage, giving horizontal scaling and schema flexibility at the price of joins and of strict consistency. Normalization splits data into many small tables so that an update touches one place, which is right for transaction processing. Analytics does the opposite: it reads enormous numbers of rows and almost never updates, so every join becomes a shuffle of terabytes across the network. Denormalized, redundant records let a scan read each record once, on the machine that holds it, which is what MapReduce is built to do.

Asked on the paper, word for word
  • Explain term 'NoSQL'. Why does normalization fail in data analytics scenario? 2068 Chaitra Q7 · 4+4
  • Define the components that make up a basic MapReduce job and illustrate with diagram how does the data flow through Hadoop MapReduce. 2068 Chaitra Q8 · 8
  • Define referential transparency with example. Explain mapreduce program execution flow. 2068 Baishakh Q7 · 10
  • Write pseudo code for inverted index (term vector per host) generation through mapreduce. 2068 Baishakh Q8a · 5
  • Discuss fault tolerance of mapreduce jobs. 2068 Baishakh Q8b · 5
  • Discuss the main points that MR draws from referential transpareny in functional programming. With an example of your choice explain the MapReduce programming model. 2067 Mangsir Q5 · 3+8
  • You are given student records consisting of following fields in each record: rollno(integer), department id (integer), name (string), subject code(integer), score on the subject (double). You can assume the delimiter of the fields as space. It is required to calculate the agerage value of score for a student and present the average score and total score along with name, department and rollno of the student in the output records. The order of the output be according to rollno, and if the same rollno appear in two departments then by rollno+department. (Note here that the rollno and department id are integers not strings). Write a complete code for mapper, reducer, combiner(if any), partitioner(if any) in Java language on Hadoop platform. You can ommit the job submission and imports part. Clearly specify the key/value data types in each phase. OR Write a complete pseudocode for mapper, reducer, partitioner(if any), combiner(if any) along with clear explanation of the key/value types in each phase. 2067 Mangsir Q6 · 10
  • Explain any 3 of the following: External sort is related with MR programming model in Hadoop 2067 Mangsir Q8b · 3
  • Explain any 3 of the following: Compression can improve the performance of MapReduce job 2067 Mangsir Q8c · 3

2.14Name services

Why naming exists at all PIN 2/22

75 Ash · 73 Shr1+42+6

"Why is naming necessary in distributed system" is a one or two mark opener in three sittings, and the answer is short but must use the right words.

  • Names refer to resources. Every resource a distributed system shares, a file, a printer, a process, a service, a user, has to be referred to somehow before it can be used.
  • Resources are accessed through identifiers or references, which are machine oriented: a port number, an object reference, an i-node number. They are efficient and unreadable.
  • A name is a human readable value that can be resolved to an identifier or an address. People and programs use names because they are stable and meaningful, while the addresses behind them change.
  • Binding is the association between a name and the thing it names, and it can be changed. That indirection is what gives location transparency: move the resource, change the binding, and every name still works.
Name service A service that stores a collection of naming contexts and, given the name of a resource, returns the information needed to reach or use it.

Requirements of a name service: it must handle an essentially arbitrary number of names and serve an arbitrary number of administrative organisations; it must be long lived, highly available, and tolerant of faults; and it must isolate errors so that a failure in one part of the name space does not break the rest. Those requirements are why DNS is built the way it is.

Asked on the paper, word for word
  • Why naming is necessary in distributed system? Explain Sun Network File System architecture with its features. 2075 Ashwin Q2 · 2+6
  • Why naming is necessary in distributed system? Explain Domain Naming Service (DNS) with its features. 2073 Shrawan Q3a · 1+4

2.15DNS

DNS: a distributed hierarchical database HOT 7/22

80 Bh · 79 Bh · 78 Bh · 75 Ash · 74 Ash · 73 Shr · 71 Ch4+42+3+21+4

DNS is asked in seven sittings, sometimes as "verify that DNS is a distributed hierarchical database system", which is a request to justify all four words. Do them in order.

  • Database: it stores records, the name to address mappings and others, and answers queries against them.
  • Hierarchical: the name space is a tree. An unnamed root at the top, then top level domains, then second level domains, and so on, with a full stop as the separator. A name is read right to left, from the most general to the most specific.
  • Distributed: no machine holds the whole database. It is cut into zones, and each zone is served by its own authoritative name servers, which are run by whoever owns that part of the tree. Delegation is by NS records pointing at the servers of the zone below.
  • And it behaves as one: any client asking any resolver gets the same answer, which is the single coherent system property of chapter 1 applied to naming.
Lecture slide: the DNS name space drawn as an inverted tree, the unnamed root at the top, then the generic top level domains com, net, org and the country code domains, then second level names such as google and yahoo below them
The name space. Root, then the generic top level domains and the country code domains, then the names organisations register under them. Each dotted boundary in practice is a zone with its own servers. From the Chapter 2 name services lecture slides

The working mechanism, with the standard example. Suppose a client wants the address of www.example.com:

Lecture note figure: a DNS lookup numbered one to eight, the client asking its local DNS server, which queries a root server, then the com server, then the authoritative server for the domain, and finally returns the address to the client
The eight steps. Draw this and number it; the numbers are the marks. From the Chapter 2 lecture notes
  1. The client issues a DNS query for the address of the name to its local DNS server.
  2. The local server, holding no answer, queries a root name server.
  3. The root returns the address of the top level domain server for com.
  4. The local server queries the TLD server.
  5. The TLD server replies with the name and address of the authoritative server for the domain.
  6. The local server queries that authoritative server.
  7. It replies with the address of www.example.com.
  8. The local server returns the address to the client, which then requests the web content from it directly.

Recursive and iterative queries, which is a two mark definition pair:

Lecture slide: a recursive DNS query, the client asking its local server for one complete answer and the local server chasing the referrals itself before replying
Recursive. The client asks once and waits; the server it asked does all the chasing and returns a complete answer. From the Chapter 2 name services lecture slides
Lecture slide: an iterative DNS query, each server answering with a referral to the next server down the hierarchy rather than with the final answer, so the asking server makes every query itself
Iterative. Each server answers with a referral to the next one down, so the asker makes every query itself. Root and TLD servers answer only iteratively, which is how they survive the load. From the Chapter 2 name services lecture slides
  • A recursive query is sent to a DNS server and requires a complete answer: the server must resolve it fully, asking others on the client's behalf, or return a failure.
  • An iterative query may be answered with a referral to another DNS server, leaving the asker to continue.
  • Root hints are the file of root server addresses that lets a resolver start at all.
  • Caching is what makes the whole thing fast: every resolver keeps answers for the record's time to live, so the root servers are asked far less than the step list suggests.
Lecture slide: a table of DNS resource record types, A for a host address, CNAME for an alias, MX for a mail exchanger, NS for an authoritative name server, SOA for the start of authority and PTR for a reverse pointer
Resource record types. The five to memorise are A, CNAME, NS, MX and PTR; SOA appears whenever a zone is discussed. From the Chapter 2 name services lecture slides
  • A: address, maps a host name to an IP address.
  • CNAME: alias, maps one name to another name, which is then resolved.
  • NS: authoritative name server for a domain, which is how delegation works.
  • MX: mail exchanger for a domain.
  • PTR: domain name pointer, used for reverse lookup from an address to a name.
  • SOA: start of authority, the parameters of a zone, including its serial number.

Valid DNS names use only A to Z, a to z, 0 to 9 and the hyphen, and a full stop separates the labels.

Asked on the paper, word for word
  • Explain file service architecture for DFS. Define queries and operation of distributed hierarchical DB: DNS. 2080 Bhadra Q3 · 4+4
  • What is recursive and iterative query? Describe working mechanism of DNS with suitable example. Mention the role of distributed file system. 2079 Bhadra Q2 · 2+3+2
  • What are the design issues on NFS? Show the complete working of DNS. 2078 Bhadra Q4 · 4+4
  • What is DNS? Explain the DNS working mechanisms with suitable example. 2075 Ashwin Q3 · 2+6
  • What is stateful and stateless service in file system? Explain the DNS working mechanism with suitable practical example. 2074 Ashwin Q3 · 3+5
  • Why naming is necessary in distributed system? Explain Domain Naming Service (DNS) with its features. 2073 Shrawan Q3a · 1+4
  • Verify with proper explanations that DNS is a distributed hierarchical database system. 2071 Chaitra Q3 · 10

2.16Directory and discovery services

Looking things up by what they are, not by their name

A name service answers "where is the thing called X". That is useless when you do not know the name, which is the normal case for a printer in an unfamiliar building. A directory service answers the other question.

Lecture slide: the difference between a naming service, which is given a name and returns the resource's attributes, and a directory service, which is given a description of attributes and returns the resources that match
The two directions. Naming service: name goes in, attributes come out. Directory service: a description goes in, the matching resources come out. From the Chapter 2 name services lecture slides
  • Name service, "white pages": given a name, return the attributes or the address. DNS is the example.
  • Directory service, "yellow pages": given a description of attributes, return the names of the resources that match. X.500 and LDAP are the examples, and an LDAP query such as "all colour printers on this floor" is the shape of it.
  • Discovery service: a directory service for a spontaneous network, where devices arrive and leave constantly. It registers services automatically as they appear and removes them when they go, so a client that has just joined a network can find what is there without being configured.

Jini's lookup service is the case study and it returns in chapter 10. A device joining the network finds a lookup service by multicast, registers a proxy object together with its attributes, and takes a lease which it must renew; when it leaves or crashes the lease expires and the entry disappears by itself. That self cleaning property is what a discovery service adds over a plain directory.

2.17Comparing the file systems

NFS, AFS and HDFS side by side

The syllabus asks for the comparison and no single question has yet demanded it, but the table is the fastest way to keep the three straight, and it answers any "which one and why" part.

PointSun NFSAFSHDFS
Server stateStatelessStateful, through callback promisesStateful master, in memory namespace
Unit transferredBlocks on demandThe whole fileBlocks of 128 MB
CacheClient memory, validated on a timerClient disk, valid until a callbackNo client cache, read once and stream
ConsistencyApproximate one copy semanticsSession semantics, visible at closeWrite once, read many: no random update
ReplicationRead only replicas onlyRead only volumesBuilt in, three copies, rack aware
Built forA LAN of workstations sharing filesA campus: many clients, few writesA cluster streaming huge files for analytics
Failure modelServer restart is invisibleCallbacks must be re-establishedNode failure is routine and automatic

The one line each: NFS made remote files look local, AFS made them scale by caching whole files, HDFS gave up general purpose file semantics entirely in exchange for surviving cheap hardware at enormous size.

2.18Last minute recall

Chapter 2 in one screen

  • Distributed object: object in another address space. Needs a remote object reference, publishes a remote interface, described in an IDL.
  • Request reply message: messageType, requestId, objectReference, methodId, arguments.
  • Three semantics: maybe (nothing), at least once (retry only), at most once (retry plus duplicate filtering plus retransmitted reply).
  • RPC in ten steps: client, client stub, client OS, server OS, server stub, server, and back.
  • RMI software: proxy, dispatcher, skeleton, plus the communication module and the remote reference module. Binder is the RMI registry.
  • Sun RPC: XDR, rpcgen, port mapper, at least once, program and version and procedure numbers.
  • DFS requirements: transparency, concurrent updates, replication, heterogeneity, fault tolerance, consistency, security.
  • File service architecture: flat file service (UFID), directory service (names), client module (single API and cache).
  • NFS: stateless, mount, virtual file system, file handle of filesystem id plus i-node number plus generation number, Sun RPC and XDR.
  • Stateless wins on crash recovery, loses on performance.
  • HDFS: one NameNode with the namespace in RAM, DataNodes with 128 MB blocks, heartbeat every 3 seconds, every tenth is a block report, rack aware pipelined write.
  • DNS: hierarchy, zones, delegation by NS records, recursive against iterative, records A, CNAME, NS, MX, PTR, SOA.

Chapter 3 · 3 hours · about 3 marks a paper · in 14 of 22 sittings, usually a sub-part or a short note

Operating system support

What the operating system underneath has to provide so that middleware can work at all: the layer itself, protection, processes and threads, the cost of an invocation, and the choice between a monolithic kernel and a microkernel. Small chapter, reliable marks, because the same three things are asked over and over.

What this chapter is about
  • The OS layer: where it sits, and the five core components it must provide.
  • Protection: why resources need it and how a kernel enforces it.
  • Process and thread: the difference, and why a distributed system cannot work without threads.
  • Communication and invocation: what a remote call actually costs and how to make it cheaper.
  • OS architecture: monolithic against microkernel, and network OS against distributed OS.
Where it fits
  • The invocation cost here is the RPC of chapter 2 measured rather than described.
  • The microkernel argument returns in chapter 10, where Mach is the case study.
  • Threads are what make a replicated or a multi client server possible in chapters 7 and 8.
What you will learn
  1. 3.1 The operating system layer and its core components
  2. 3.2 Protection and the kernel
  3. 3.3 Processes and threads
  4. 3.4 Communication and invocation
  5. 3.5 Monolithic kernel and microkernel
  6. 3.6 Network OS, distributed OS and middleware
  7. 3.7 Last minute recall, chapter 3
How it is examined
  • Monolithic against microkernel is the most asked item in the chapter: six sittings, three or four marks each.
  • Process against thread and NOS against DOS are the other two, and both are table answers.
  • It is almost never a full question, so budget three or four minutes and write the table.

3.1The operating system layer

Where the OS sits, and what it must provide PIN 1/22

71 Ch4+2+2

Start with the stack, because the whole chapter is about one layer of it. At the bottom is the computer and network hardware. Above it sits the operating system. Above that sits the middleware, and above that the applications and services. The hardware plus the operating system together are called the platform.

Textbook figure: two nodes, each with computer and network hardware at the bottom, its own operating system of processes, threads and communication above that, then one common middleware layer spanning both, and applications and services on top
Two nodes, one middleware. Each node has its own operating system, and each may be a different one. The middleware layer spans them and is what makes the pair look like one system. From the Distributed Systems lecture notes

What the OS is for, in one sentence: it provides problem oriented abstractions of the underlying physical resources, so that middleware does not have to deal with disks, interrupts and page tables. The combination of middleware and OS must have good performance, because every remote invocation passes through both.

The division of labour. The middleware provides the remote invocation mechanisms between objects or processes at different nodes, and uses the local resources properly. The kernel and the server processes manage those resources and present clients with an interface to them. A client reaches a resource either by invoking a server object or by making a system call to the kernel.

Three duties of a kernel as a resource manager, which is a common two mark item:

  • Encapsulation: the resource is offered as a useful service, with its representation and its manipulation hidden behind that interface.
  • Protection: the resource is shielded from illegitimate access.
  • Concurrent processing: several clients may use the resource at once, transparently to each other.
Textbook figure: the core operating system components drawn as nested boxes, the process manager across the top, the communication manager in the centre, the thread manager and memory manager below it, and the supervisor along the bottom
The five core components. This is the picture behind "what functions should an OS provide for middleware". From the Distributed Systems lecture notes
  • Process manager: handles the creation of processes and the operations upon them.
  • Thread manager: thread creation, synchronisation and scheduling.
  • Communication manager: communication between threads attached to different processes, on the same computer or on remote ones. In some systems an extra service is needed for remote communication.
  • Memory manager: management of physical and virtual memory, so that data can be shared efficiently.
  • Supervisor: dispatching interrupts, system call traps and other exceptions; memory management control; and control of the hardware cache and registers.
Asked on the paper, word for word
  • List the goals of JINI. What are CORBA services? How does operating system support for distributed system? 2071 Chaitra Q5 · 4+2+2

3.2Protection

Keeping a resource safe from the wrong operation

The problem, with the standard example. Take a file that supports only read and write. An illegitimate access is not only an outsider reading it; it is also a client who holds read rights performing a write. So protection is not just about who you are, it is about which operations your rights permit on that resource.

Two ways to enforce it:

  • In the language. A type safe language such as Java guarantees that no module can reach a target module without holding a reference to it, and that a reference can only be used in ways the type allows. Protection is then a compile time and run time property of the language, with no hardware involved.
  • In the hardware, through a kernel. This is the general answer, because it works for code written in any language, including machine code.
Kernel A program that executes with complete access privileges for the physical resources of its host computer, controls memory management, and ensures that physical resources are reached only by acceptable code.

How the kernel does it. The kernel process runs in supervisor mode and forces every other process to run in user mode. It sets up an address space for each process, and a process cannot reach memory outside its own address space, because the hardware refuses. The only ways to change address space are an interrupt or a system call trap, and both hand control to the kernel, which checks the request before acting.

That is the whole mechanism: user mode plus a private address space plus a controlled doorway. Everything else in operating system protection is a refinement of it.

3.3Processes and threads

Why a distributed system needs threads HOT 5/22

80 Ba · 79 Bh · 72 Ka · 70 Ch · 70 Asa44+2+22+2

Process and thread A process is an instance of a program being executed, with an address space and, in a traditional operating system, a single thread of control. A thread is a lightweight process that shares the address space of its process but runs in quasi parallel with the other threads in it. A thread is the operating system's abstraction of an activity.

The execution environment is the other half of the definition and it is what makes the comparison clean. A process consists of an execution environment, the local kernel managed resources, plus one or more threads that share it. The execution environment holds the address space, the communication interfaces such as sockets and ports, and the synchronisation resources such as semaphores. The thread holds only its own program counter, registers, stack and scheduling state.

PointProcessThread
MemoryRuns in its own separate memory spaceThreads of a process share one memory space
IndependenceA self contained entityDepends on its process to exist
ResourcesHeavy: a full address space and environmentMinimal: a stack and registers
CommunicationNeeds inter process communicationShares variables directly, so it is easy
OverheadCreation and switching are expensiveCreation is 10 to 20 times cheaper, switching 5 to 50 times cheaper
ProtectionProtected from other processesNot protected from the other threads of its process
FailureOne process crashing leaves others aliveOne thread corrupting memory can kill the whole process

Why threads matter in a distributed system, which is the four mark version of this question:

  • Multiple users need concurrency. A server must serve many clients at once, and without threads a single process would handle them strictly one after another.
  • A thread can block on a system call without blocking the process. This is the key one. A remote call takes milliseconds, and in that time the other threads keep working, so a server can hold many logical connections open at the same time.
  • Threads of one process can run in parallel on different processors, so a multiprocessor server is actually used.
  • Threads share a common buffer, which makes patterns such as producer and consumer easy to implement, and makes caching in a server natural.

Three server threading architectures, since papers ask how the threads are organised in practice:

Textbook figure: three server threading architectures side by side, thread per request, thread per connection and thread per object, each drawn as a server process with worker threads reaching the remote objects
The three arrangements. Thread per request scales but spends its life creating threads; thread per connection matches TCP; thread per object gives each shared object one thread and so needs no synchronisation inside it. From the Distributed Systems lecture notes
  • Thread per request: the I/O thread creates a new worker for every request and discards it afterwards. It maximises throughput and suits a connectionless service such as NTP, and the creation cost is paid on every call.
  • Thread per connection: one thread per client connection, which matches the TCP model and is the most commonly used. A busy connection can starve a quiet one.
  • Thread per object: one thread per remote object, with requests queued for it. Each object has exactly one thread, so no synchronisation is needed inside the object.
  • Worker pool: a fixed set of workers takes requests from a queue, which bounds the resources used and allows priorities.
Asked on the paper, word for word
  • Write short notes on: Multithreading in DS 2080 Baishakh Q9c · 4
  • Write short notes on: Process and threads in a DS 2079 Bhadra Q9a · 3
  • How threads differ from process? How does checkpoint help in recovery? What does distributed commit refer to? 2072 Kartik Q4 · 4+2+2
  • Compare process and threads. Why threads are important in distributed System. 2070 Chaitra Q4 · 2+2
  • Write short notes on: Process and threads in OS 2070 Ashad Q11a · 4

3.4Communication and invocation

What a remote invocation costs, and how to make it cheaper

This section exists because the whole idea of hiding the network behind a method call only works if the call is fast enough. So the operating system's job is to make invocation cheap.

Where the time goes in a null RPC, that is a call with no arguments and no work at the server. Nothing here is the network's fault, which is the point:

  • Marshalling and unmarshalling: converting arguments to and from the external representation, done four times per call.
  • Data copying: a message may be copied several times, between user space and kernel buffers and down through the protocol layers.
  • Packet initialisation: filling in headers and checksums at each layer.
  • Thread scheduling and context switching: several system calls per invocation, and a switch of address space at each end.
  • Waiting for acknowledgements, which matters most for large transfers.

The shape of the delay curve. RPC delay is not proportional to the size of the arguments. There is a large fixed cost at zero size, and the line then rises gently with the data, with a step whenever the data crosses a packet boundary. That is why a design that makes many small calls is much worse than one that makes a few large ones.

Textbook figure: two time diagrams comparing serialised and concurrent invocations between a client and a server, showing that concurrent invocations overlap the marshalling and transmission of one call with the execution of another
Serialised against concurrent invocations. With concurrent invocations the client marshals and sends the next call while the server is still executing the previous one, so the total time is far shorter than the sum of the parts. From the Distributed Systems lecture notes

Ways to make invocation cheaper:

  • Concurrent invocation. Do not wait for each reply before issuing the next call, so the delays overlap, as the figure shows.
  • Asynchronous operation. The client continues immediately and collects the result later, which hides the latency of a wide area network.
  • Shared memory between client and server when both are on one machine, so arguments are not copied at all.
  • Lightweight RPC (LRPC). For a call within one machine, the client and server share an argument stack in mapped memory, the client's own thread executes the server procedure by trapping into the kernel and back out, and only one context switch is needed instead of four. It is several times faster than a conventional local RPC.
  • Choosing the right protocol: UDP for short request reply exchanges, TCP where the data is large enough for its overhead to be repaid.

3.5Monolithic kernel and microkernel

One big kernel, or a small one with servers around it HOT 6/22

79 Bh · 76 Ash · 75 Ash · 73 Shr · 72 Ka · 71 Shr342+3

This is the most asked topic in the chapter, and the answer is always the same shape: define both, give the table, then say which one suits a distributed system and why.

Textbook figure: a monolithic kernel drawn as one wide block containing all the server code, beside a microkernel drawn as a narrow block with the servers S1 to S4 as separate dynamically loaded processes above it
The two pictures. On the left every service S1 to S4 is inside the one kernel block. On the right the kernel is narrow and the servers are separate, dynamically loaded processes. From the Distributed Systems lecture notes
Monolithic kernel A single large process running in a single address space, in which all kernel services execute in kernel space.
Microkernel A kernel broken into separate processes called servers, which run partly in kernel space and partly in user space, leaving only the minimum in the kernel itself.
PointMonolithic kernelMicrokernel
StructureOne large process, one address spaceSmall kernel plus separate server processes
SpeedFaster: no address space switch to reach a kernel serviceSlower: a service call is a message between processes
Device driversInside kernel space, which makes it less secureIn user space
A fault in one serviceCollapses the whole kernelKills only that server, and it can be restarted
Adding a featureRequires recompiling the whole kernelLoad another server; the kernel is untouched
Size and portabilityLarge and tied to its hardwareSmall, so it is easier to port
ExamplesUNIX and Linux kernelsMac OS X and Windows NT kernels, Mach, Chorus

Which one for a distributed operating system, and why. The microkernel, for three reasons your notes give directly:

  • The services of a distributed system are complex, and the microkernel's separation of them into servers makes that complexity manageable.
  • It gives faster communication among processes with low overhead, which is what a distributed system does constantly.
  • It is extensible: a distributed system needs services that were not anticipated, and a new server can be added without touching the kernel, and can even be placed on a different machine.

The honest counterpoint, worth a line if the question says "in your view": pure microkernels lost on performance, so real systems are hybrid. They keep a microkernel structure but move the performance critical servers back into kernel space, which is what Windows NT and macOS actually do.

Asked on the paper, word for word
  • Write short notes on: Monolithic and micro kernel 2079 Bhadra Q9d · 3
  • Write short notes on any two: Monolithic and micro kernel 2076 Ashwin Q10b · 4
  • What do you mean by DOS (Distributed Operating System)? Briefly explain the Monolithic and microkernel architectures of operation system. 2075 Ashwin Q4 · 2+4
  • What are the advantages of micro-kernel over monolithic-kernel? In your view, which kernel is preferable for distributed Operating system and why? 2073 Shrawan Q3b · 2+3
  • Write short notes on: Monolithic and Microkernel 2072 Kartik Q9d · 3
  • Write short notes on (Any Three): Monolithic and Micro-Kernel 2071 Shrawan Q9a · 4

3.6Network OS, distributed OS and middleware

Three answers to "make these machines work together" HOT 6/22

78 Bh · 75 Ash · 74 Ash · 72 Ch · 70 Ch · 69 Ch2+44+44

Network OS An operating system with networking capability, which can be used to reach remote resources. Each node keeps its own system image, and a user can log in to another computer and run processes there, explicitly.
Distributed OS An operating system that produces a single system image for all the resources of the distributed system. Users are never concerned with where their programs run, and the operating system has control over all the nodes.
Textbook table: the three types of distributed operating system, DOS as a tightly coupled system for multiprocessors and homogeneous multicomputers, NOS as a loosely coupled system for heterogeneous multicomputers, and middleware as a layer atop NOS, each with its main goal
The three, with their main goals. Notice the third row: middleware is a layer on top of a network OS, which is how real distributed systems are actually built. From the Distributed Systems lecture notes
PointNetwork OSDistributed OS
Also calledThe dialogueThe middleware
System imageOne per node; the user sees many machinesOne for the whole system; the user sees one machine
CouplingLoosely coupledTightly coupled
Built forHeterogeneous multicomputers on a LAN or WANMultiprocessors and homogeneous multicomputers
Main goalOffer local services to remote clientsHide and manage the hardware resources
Where work runsOn the server the user connected to; the client only relays input and outputWherever the system decides, balancing load across idle and busy machines
Load balancingNone, so it handles computation intensive work badlyKnows which machines are idle and shares the load
Client hardwareEnough to boot and contact the serverRelatively little needed on the user terminal

Why NOS is preferred over DOS in practice, which is asked directly (2069 Chaitra) and surprises students who expect the more advanced answer to win:

  • Existing applications. Users invest in applications that solve their current problems. They will not move to a new operating system that cannot run those applications, even if it is more efficient.
  • Autonomy. Users want a degree of control over their own machine even inside a close knit organisation, because they do not want their work slowed down by somebody else's process being scheduled onto it.

So the real answer is the third row of the table: a middleware layer on top of an ordinary network operating system. It gives the distribution transparency people want from a distributed OS while leaving each machine its own operating system and its own owner, which is why DOS is described as "middleware" in the comparison.

Characteristics of a distributed operating system, for the question that asks for them directly: a single system image; transparent resource access and process migration; global resource management and load sharing; data migration, moving a whole file or only the parts needed; computation migration, moving the computation to the data rather than the data to the computation; a global file system and a global name space; and tolerance of node failure.

Asked on the paper, word for word
  • What are the key differences between Network OS and Distributed OS. 2078 Bhadra Q3a · 4
  • What do you mean by DOS (Distributed Operating System)? Briefly explain the Monolithic and microkernel architectures of operation system. 2075 Ashwin Q4 · 2+4
  • What are the characteristics of distributed operating system? Explain ORB and its interfaces. 2074 Ashwin Q4 · 4+4
  • Write short notes on: Distributed OS 2072 Chaitra Q9a · 4
  • Give an example of heterogeneous model of distributed application. How is distributed operating system realized in practical distributed systems? Explain. 2070 Chaitra Q5 · 2+4
  • Why network operating system (NOS) is widely preferred over distributed operating system (DOS) in practical distributed systems? Explain DOS as a middleware. 2069 Chaitra Q4 · 4+4

3.7Last minute recall

Chapter 3 in one screen

  • The stack: hardware, OS, middleware, applications. Hardware plus OS is the platform.
  • Five core components: process manager, thread manager, communication manager, memory manager, supervisor.
  • Kernel as resource manager: encapsulation, protection, concurrent processing.
  • Protection: user mode plus a private address space plus system call traps. Or a type safe language.
  • Process against thread: separate memory against shared memory; self contained against dependent; heavy against minimal; IPC against shared variables.
  • Threads matter because a blocking call does not block the process.
  • Threading architectures: thread per request, thread per connection, thread per object, worker pool.
  • Invocation cost: marshalling, data copying, packet initialisation, scheduling and context switching. Fixed cost dominates. LRPC cuts it to one context switch.
  • Monolithic: fast, all in one address space, a fault kills everything, recompile to extend. Microkernel: slower, servers in user space, faults contained, extensible. Microkernel wins for a distributed OS.
  • NOS: own image per node, loosely coupled, offers local services to remote clients. DOS: single image, tightly coupled, hides and manages hardware. NOS plus middleware is what is actually used.

Chapter 4 · 3 hours · about 5 marks a paper · in 18 of 22 sittings

Distributed heterogeneous applications and CORBA

Real distributed systems are built from machines, operating systems and languages that were never designed to work together. Middleware is the layer that makes them, and CORBA is the standard that defines what that layer must do. Small chapter, and one of the most reliably examined: CORBA architecture, CORBA services or the object adapter turns up almost every year.

What this chapter is about
  • Heterogeneity: what actually differs between the parts of a real system, and why.
  • Middleware: the layer that hides those differences, and the roles it plays.
  • CORBA: the OMG standard, its components, and the ORB at the centre.
  • Static and dynamic invocation, and the two repositories that make dynamic invocation possible.
  • The object adapter and the CORBA services.
Where it fits
  • CORBA is RMI from chapter 2 made language neutral. The proxy, skeleton, communication module and remote reference module are all still there, with CORBA names.
  • The CORBA transaction and concurrency services are chapter 8's protocols offered as a service.
  • Chapter 10 returns to CORBA as a case study and compares it with Mach and JINI.
What you will learn
  1. 4.1 Heterogeneity in distributed systems
  2. 4.2 Middleware and its roles
  3. 4.3 Objects in distributed systems, and IDL
  4. 4.4 The CORBA approach and its components
  5. 4.5 The ORB and its interfaces
  6. 4.6 Static and dynamic invocation
  7. 4.7 The object adapter
  8. 4.8 CORBA services
  9. 4.9 Last minute recall, chapter 4
How it is examined
  • "Explain CORBA architecture with a diagram" is worth two to eight marks and comes round in ten sittings. Draw the components figure.
  • "CORBA services" is a short note or a tail in nine sittings. Learn six services with one line each.
  • The object adapter and ORB interfaces are the two sub-parts that separate a full answer from a half one.

4.1Heterogeneity in distributed systems

What actually differs, and why it differs HOT 4/22

75 Ch · 71 Ch · 70 Ch · 70 Asa42+43+5

Heterogeneous computing A system that uses more than one kind of processor or core, and more generally a distributed system whose different kinds of hardware and software work together cooperatively to solve a problem.

Distributed applications are heterogeneous in four ways, and a question worth three or four marks wants all four with examples:

  • Different hardware: mainframes, workstations, personal computers, servers.
  • Different software: UNIX, MS Windows, IBM OS/2, real time operating systems.
  • Unconventional devices: teller machines, telephone switches, robots, manufacturing systems.
  • Diverse networks and protocols: Ethernet, FDDI, ATM, TCP/IP, Novell NetWare.

Why any of this is allowed to happen, which is the part students skip:

  • Different hardware and software solutions are optimal for different parts of the system: a teller machine and a database server should not be the same computer.
  • The different users who have to interact choose different vendors, and they cannot be forced to agree.
  • Legacy systems already exist and cannot be thrown away, so the new system must speak to them.

Homogeneous against heterogeneous, the comparison some papers ask for directly: a homogeneous distributed system has the same hardware, operating system and network throughout, which makes it simple, fast and easy to manage, and is what a cluster is. A heterogeneous one differs on all of those, which is what a grid or any real corporate system is: harder to build, and it is what the world actually looks like. The integration of heterogeneous components is what forces the construction of a distributed system in the first place, and the communication between them is the problem middleware exists to solve.

Asked on the paper, word for word
  • Compare heterogeneous and homogeneous distributed system. Explain the CORBA architecture and its services. 2075 Chaitra Q4 · 3+5
  • Write short notes on: Heterogeneity in distributed system 2071 Chaitra Q9a · 4
  • Give an example of heterogeneous model of distributed application. How is distributed operating system realized in practical distributed systems? Explain. 2070 Chaitra Q5 · 2+4
  • Differentiate between homogeneous and heterogeneous distributed applications with example. 2070 Ashad Q4 · 4

4.2Middleware

The layer that makes heterogeneity survivable HOT 5/22

80 Ba · 78 Bh · 72 Ch · 72 Ka · 69 Ch2+62+83+5

Middleware A software layer situated between the applications and the operating systems, made of a set of services that let applications and end users interact with each other across a heterogeneous distributed system. It resides above the network and below the application software.
Lecture slide: client objects and server objects sitting above the object request broker, with object services below it, the whole broker and services layer labelled middleware
Where middleware sits. Client objects and server objects above; the object request broker and the object services below them. Together the broker and the services are the middleware. From the Chapter 4 lecture slides, Petru Eles, IDA, LiTH

What middleware does, the four point list from your notes:

  • Hides the intricacies of distributed applications, so a programmer writes a call rather than a protocol.
  • Hides the heterogeneity of hardware, operating systems and protocols.
  • Provides uniform and high level interfaces, which is what makes applications interoperable, reusable and portable.
  • Provides a set of common services, so that every application does not reimplement naming, security and transactions, which minimises duplicated effort and lets applications collaborate.

The role of middleware in a distributed system, which is a separate question in four sittings and wants the verbs, not the definition:

  • It provides services the operating system does not, so the components of the system can communicate and manage data.
  • Its major role is to handle communication between components, without assuming anything about the content beyond that the receiver can understand it.
  • It performs load management: starting and stopping services and directing load to them.
  • It provides authentication and authorisation, audit and logging.
  • It provides interoperability between applications running on different operating systems.

Middleware compared with an operating system, a neat line that earns a mark: an operating system provides an API for using the underlying hardware; middleware provides an API for using the underlying operating system. Both support other programs, control their interaction and prevent interference, but middleware does it across a network.

What counts as middleware. Quite a lot qualifies to some degree, which is worth saying because examiners accept the range: file transfer packages and email, web browsers, and the proper article, CORBA. The usual classification is RPC and RMI middleware, message oriented middleware, object request brokers and transaction processing monitors.

Asked on the paper, word for word
  • Explain the role of middleware in Distributed System. Explain the operation of dynamic RMI. 2080 Baishakh Q2 · 2+6
  • Explain the various roles of middleware in DS. 2078 Bhadra Q3b · 4
  • What is the role of middleware in DS? Explain about CORBA and its services. 2072 Chaitra Q4 · 2+8
  • Mention the role of IDL and middleware in Distributed System. Explain RMI approach in the distributed object based system. 2072 Kartik Q2 · 4+6
  • How do you convince that middleware plays the important role in Distributed System? Explain the operation of RPC in client server communication in Distributed System. 2069 Chaitra Q2 · 3+5

4.3Objects in distributed systems

Objects, brokers and the interface contract

The model. A distributed application can be viewed as a collection of objects: user interfaces, databases, application modules, customers. Each object is data surrounded by code, with its own attributes and methods that define its behaviour, and each object can be a client, a server, or both at different moments.

Two kinds of middleware support those objects:

  • Object brokers let objects find each other in a distributed system and interact over the network. They are the backbone of a distributed object oriented system.
  • Object services let objects be created, named, moved, copied, stored, deleted, restored and managed.

A caution the notes make explicitly: modelling a system in object oriented terms does not force you to implement it in an object oriented language or to use an object oriented database. The object model is the interface, not the implementation.

Interface definition language

An interface specifies the API a client uses to invoke operations on an object: the set of operations and the parameters each one needs. One object may have several interfaces, so different classes of user can be given different views of the same object.

Interfaces are written in an IDL, and CORBA IDL is the example. The important properties:

  • Middleware provides an interface compiler that parses the IDL and produces the classes for the proxies in the client's language and the skeletons in the server's language. If the client or server is not in an object oriented language, the compiler produces a client stub and a server stub instead.
  • IDLs are declarative: they specify declarations only, never executable code.
  • IDLs must be implementation language independent, so the interface is defined without reference to the language either side is written in. Language mappings then define how IDL types become types in C, C++, Java and so on.

This is the same IDL idea introduced with distributed objects in chapter 2; here it becomes the whole basis of the architecture.

4.4The CORBA approach

What CORBA is, and the components to draw TOP 10/22

80 Bh · 79 Bh · 78 Bh · 76 Ch · 76 Ash · 75 Ch · 74 Ash · 73 Shr · 72 Ch · 69 Ch342+4

Who made it. The Object Management Group (OMG) is a non profit industry consortium formed in 1989 to develop, adopt and promote standards for building distributed heterogeneous applications. Its main achievement is the specification of the Common Object Request Broker Architecture.

What the specification actually is. It details the interfaces and characteristics of the Object Request Broker, that is, it specifies the middleware functions that let application objects communicate with one another no matter where they are located, who designed them, or in which language they are implemented. OMG provides only a specification; several products implement it to varying degrees.

The key concepts, which is a good six point answer on its own:

  • CORBA specifies the middleware services used by the application objects.
  • An object can be a client, a server, or both.
  • Object interaction is through requests, and a request carries three things: an operation to be performed, a target object, and zero or more parameters.
  • CORBA supports static and dynamic binding; dynamic binding identifies objects and parameters at run time.
  • The interface is the contract between client and server. An IDL is defined for CORBA, and proxies and skeletons are generated by compiling it.
  • CORBA objects do not know the implementation details underneath them: an object adapter maps the generic model onto a specific implementation.
Lecture slide: the components of a CORBA environment, two client applications reaching the object request broker through the dynamic invocation interface and a static proxy, an interface repository beside them, and on the server side the object adapter, the server skeleton and the implementation repository
The components of a CORBA environment. This is the diagram to draw. Note the two paths from a client: dynamic invocation, which consults the interface repository, and a static proxy, which does not. From the Chapter 4 lecture slides, Petru Eles, IDA, LiTH
  • Client application and server object: the application code at each end.
  • Proxy (static): the client side stub generated from the IDL, used when the interface is known at compile time.
  • Dynamic invocation interface: the path used when it is not, building the request at run time.
  • Interface repository: holds a standard representation of the available object interfaces, corresponding to the servers' IDL specifications. Clients read it to learn what operations an object offers and what parameters they take, which is what makes dynamic invocation possible.
  • Server skeleton: the server side piece generated from the IDL, which invokes the right method on the server object.
  • Object adapter: the interface between the server object implementation and the ORB.
  • Implementation repository: holds the implementation details for the objects that implement each interface. Mainly it maps a server object's name to the file that implements the service, plus information about the object methods and what is needed to select one. Its contents may be specific to the operating system of that server and to that CORBA product. The object adapter uses it to resolve an incoming call and activate the right method through a skeleton.
  • Object Request Broker (ORB): the bus underneath everything, carrying requests from client to object and results back.

Keep the two repositories straight, because a question often names only one: the interface repository answers "what can this object do", and the implementation repository answers "which code do I run and where is it".

Asked on the paper, word for word
  • What is RMI? Explain CORBA architecture in Distributed System along with services. 2080 Bhadra Q4 · 2+6
  • Write short notes on: ORB and its interfaces 2079 Bhadra Q9b · 3
  • Write short notes on: CORBA Architecture 2078 Bhadra Q10c · 4
  • Write short notes on: CORBA component for RMI 2076 Chaitra Q9b · 3
  • Explain components in CORBA architecture with a diagram. 2076 Ashwin Q4 · 8
  • Compare heterogeneous and homogeneous distributed system. Explain the CORBA architecture and its services. 2075 Chaitra Q4 · 3+5
  • What are the characteristics of distributed operating system? Explain ORB and its interfaces. 2074 Ashwin Q4 · 4+4
  • What are the components of CORBA environment? 2073 Shrawan Q4a · 4
  • What is the role of middleware in DS? Explain about CORBA and its services. 2072 Chaitra Q4 · 2+8
  • What is IDL? Explain CORBA RMI with its services. 2069 Chaitra Q11 · 2+4

4.5The ORB and its interfaces

What the ORB does, and which parts are standard

Object Request Broker The middleware bus that, through its interfaces, provides the mechanisms by which objects transparently interact with each other: it locates the target object, transmits the request, activates the object if necessary, and returns the result.
Lecture slide: the ORB and its interfaces, with shading showing which parts are implementation dependent, which are identical for every ORB implementation, and which are the proxies and skeletons generated per server interface
The ORB and its interfaces. The shading is the point: the black interface is implementation dependent, the plain one is identical for every ORB implementation, and the hatched pieces are generated per server interface. From the Chapter 4 lecture slides, Petru Eles, IDA, LiTH

What the ORB provides, in three statements:

  • Issuing a request can be static or dynamic. It goes either through the proxies, which are the client stubs, or through the dynamic invocation interface.
  • Invoking a specific server method is done by the server skeleton, which receives the request forwarded by the object adapter.
  • The ORB interface can be used directly by clients and by object implementations for certain services: directory services, services connected with naming, and the manipulation of object references.

Why the shading matters. The interface that is identical for all ORB implementations is what makes a client portable between products; the implementation dependent interface is where products differ and where portability ends. That distinction is the reason CORBA interoperability was hard in practice, and it is worth one line in an answer about CORBA's limitations.

Compare this with the RMI software picture: the CORBA proxy is the RMI proxy, the CORBA skeleton is the RMI skeleton, and the ORB contains the communication module and the remote reference module.

Lecture slide: a client object A calling the proxy for B, the request crossing two ORBs to the object adapter and the skeleton for B on the server, with the interface repository and implementation repository beside the adapter
The same call, drawn as RMI. Object A calls the proxy for B, the request crosses the two ORBs, and the object adapter passes it to the skeleton for B, consulting the two repositories on the way. From the Chapter 4 lecture slides, Petru Eles, IDA, LiTH

4.6Static and dynamic invocation

Two ways to issue a request, and when each is used PIN 3/22

81 Bh · 75 Ash · 70 Asa2+44

CORBA allows both, and the choice depends on how much is known about the server object at compile time.

Static invocation.

  • It is based on compile time knowledge of the server's interface specification.
  • That specification is written in IDL and compiled into a proxy, the client stub, in the programming language the client is written in.
  • For the client, the invocation looks like a local call to a proxy method. It is then forwarded automatically to the object implementation through the ORB, the object adapter and the skeleton.
  • It is efficient at run time, because the overhead is low, and it is type checked by the compiler.

Dynamic invocation.

  • It lets a client invoke requests on an object without compile time knowledge of its interface.
  • The object and its interface, that is its methods, parameters and types, are detected at run time. The dynamic invocation interface provides the mechanisms to inspect the interface repository, construct the invocation, and supply argument values matching the server's interface.
  • Once the request has been constructed and the arguments placed, invoking it has the same effect as a static invocation.
  • Its execution overhead is huge compared with a static call.

The point examiners like: from the server's point of view, static and dynamic invocation are identical. The server does not know how it was invoked, because the invocation always arrives through its skeleton, which was generated at compile time from the IDL specification. The server side counterpart, used when the server itself does not know the interface at compile time, is the dynamic skeleton interface.

Use dynamic invocation for tools that browse or manage services, gateways and bridges between systems, and scripting environments. Use static invocation for everything else.

Asked on the paper, word for word
  • Write short notes on: CORBA dynamic invocation 2081 Bhadra Q10d · 4
  • Define Object Adapter. Explain the invocation methods in CORBA. 2075 Ashwin Q5 · 2+4
  • Write different services provided by CORBA. What are dynamic and static invocation approaches of CORBA. 2070 Ashad Q10 · 2+4

4.7The object adapter

The four services the object adapter provides PIN 2/22

75 Ash · 71 Shr2+44

Object adapter The primary interface between the server object implementation and the ORB. It hides from the ORB how the object is actually implemented, and hides from the object how the ORB delivers a request.

The four services, which is the whole answer to "functions of the object adapter":

  • Object registration. It provides the operations by which entities written in some programming language are registered as CORBA objects.
  • Object reference generation. It generates the object references that identify those CORBA objects to the rest of the system.
  • Object upcalls. It dispatches incoming requests to the corresponding registered objects, through their skeletons.
  • Server process and object activation. If needed, it starts up server processes and activates objects as a result of incoming invocations, so a server need not be running all the time.

Why it exists at all. Without an adapter the ORB would have to know how every implementation language and every server arrangement works. With it, the ORB deals with one uniform interface and each adapter deals with one style of implementation. The original was the Basic Object Adapter; because implementations diverged, OMG later standardised the Portable Object Adapter, which is what makes server code portable between ORB products.

Asked on the paper, word for word
  • Define Object Adapter. Explain the invocation methods in CORBA. 2075 Ashwin Q5 · 2+4
  • Write short notes on (Any Three): Services provided by CORBA with the functions of Object Adapter 2071 Shrawan Q9b · 4

4.8CORBA services

The services to name, with one line each TOP 9/22

80 Bh · 80 Ba · 75 Ch · 72 Ch · 72 Ka · 71 Ch · 71 Shr · 70 Asa · 69 Ch2+444+2+2

CORBA specifies a long list of services and current products implement only some of them. Six are enough for a four mark note, and the first two are the ones an examiner looks for.

  • Naming service. The basic way an object reference is generated is at the creation of the object, when the reference is returned. References can be stored together with associated information such as names and properties. The naming service lets clients find objects by name.
  • Trading service. Lets clients find objects by their properties rather than by name, which is the directory service idea of chapter 2 applied to objects.
  • Transaction management service. Provides two phase commit coordination among recoverable components that use transactions.
  • Concurrency control service. Provides a lock manager that can obtain and free locks for transactions or for threads.
  • Security service. Protects components from unauthorised users. It provides authentication, access control lists and confidentiality.
  • Time service. Provides interfaces for synchronising time, and operations for defining and managing time triggered events.

Three more that are worth adding when the question is worth six or eight marks: the event service, which decouples suppliers and consumers of events as in chapter 2; the persistence service, which stores an object's state so it survives its process; and the life cycle service, which creates, copies, moves and deletes objects.

Notice how much of chapter 8 arrives here as a service: the transaction service is two phase commit and the concurrency service is locking, offered so that an application does not have to implement them.

Asked on the paper, word for word
  • What is RMI? Explain CORBA architecture in Distributed System along with services. 2080 Bhadra Q4 · 2+6
  • Write short notes on: CORBA services 2080 Baishakh Q9d · 4
  • Compare heterogeneous and homogeneous distributed system. Explain the CORBA architecture and its services. 2075 Chaitra Q4 · 3+5
  • What is the role of middleware in DS? Explain about CORBA and its services. 2072 Chaitra Q4 · 2+8
  • Write short notes on: CORBA services 2072 Kartik Q9c · 3
  • List the goals of JINI. What are CORBA services? How does operating system support for distributed system? 2071 Chaitra Q5 · 4+2+2
  • Write short notes on (Any Three): Services provided by CORBA with the functions of Object Adapter 2071 Shrawan Q9b · 4
  • Write different services provided by CORBA. What are dynamic and static invocation approaches of CORBA. 2070 Ashad Q10 · 2+4
  • What is IDL? Explain CORBA RMI with its services. 2069 Chaitra Q11 · 2+4

4.9Last minute recall

Chapter 4 in one screen

  • Heterogeneity in four kinds: hardware, software, unconventional devices, diverse networks. Because different parts need different solutions, users choose different vendors, and legacy systems exist.
  • Middleware: a layer between applications and operating systems. Hides intricacies, hides heterogeneity, gives uniform high level interfaces, provides common services.
  • OS gives an API for the hardware; middleware gives an API for the OS.
  • IDL: declarative, language independent, compiled into proxies and skeletons, or client and server stubs for non object languages.
  • OMG formed 1989, specified CORBA. Specification only, many products.
  • A request carries three things: an operation, a target object, zero or more parameters.
  • CORBA components: client application, dynamic invocation, static proxy, interface repository, ORB, object adapter, server skeleton, implementation repository, server object.
  • Interface repository: what an object can do. Implementation repository: which code to run.
  • Static invocation: compile time knowledge, low overhead. Dynamic invocation: run time discovery, huge overhead, identical to the server.
  • Object adapter, four services: object registration, object reference generation, object upcalls, server process and object activation.
  • CORBA services: naming, trading, transaction management, concurrency control, security, time.

Chapter 5 · 5 hours · about 8 marks a paper · in 18 of 22 sittings

Time and state in distributed systems

There is no global clock, so this chapter builds two substitutes. Physical clock synchronisation pulls the real clocks closer together; logical clocks give an ordering of events that needs no clock at all. Then, because you cannot photograph a system that has no common instant, it shows how to record a consistent global state anyway. Every paper sets a question from here.

What this chapter is about
  • Why clocks disagree: drift, skew, and what can and cannot be fixed.
  • Three physical algorithms: Cristian, Berkeley and NTP, each solving a different version of the problem.
  • Logical clocks: happened before, Lamport's counter, and the one thing it cannot do.
  • Vector clocks: the fix, and how to read two timestamps to decide causality.
  • Global state: cuts, consistency, and the Chandy and Lamport snapshot algorithm.
Where it fits
What you will learn
  1. 5.1 Time, physical clocks and why they drift
  2. 5.2 Cristian's method
  3. 5.3 Berkeley's algorithm
  4. 5.4 Network Time Protocol
  5. 5.5 Logical clocks and Lamport's algorithm
  6. 5.6 Vector clocks
  7. 5.7 Causal ordering of messages
  8. 5.8 Global state, cuts and consistency
  9. 5.9 The Chandy and Lamport snapshot algorithm
  10. 5.10 Distributed debugging
  11. 5.11 Last minute recall, chapter 5
How it is examined
  • Lamport's clock is the single most asked item in the subject: eleven sittings, usually six marks, and nearly always "with an example".
  • The pairing repeats: a two mark "physical against logical clock", then a six mark algorithm.
  • Always draw the three process diagram and stamp it. A clock answer without a worked diagram loses half the marks.

5.1Time and physical clocks

Why no two computers agree on the time TOP 10/22

81 Bh · 81 Ba · 80 Ba · 74 Ash · 72 Ch · 72 Ka · 71 Shr · 70 Ch · 70 Asa · 69 Ch2+62+4+22+2+4

What a physical clock actually is. Every computer contains an electronic device that counts the oscillations of a crystal at a definite frequency and stores the count divided by the frequency in a register. That register is the clock, and the value it holds is the physical time.

Why they disagree. Different computers have different crystals, and no two crystals oscillate at exactly the same rate. Even a small difference accumulates: the clocks gradually drift out of synchronisation and report different values. That is the whole problem, and it cannot be removed, only corrected repeatedly.

Lecture slide: a graph of clock time against UTC, with a perfect clock as the diagonal, a fast clock drifting above it and a slow clock drifting below it
Drift, drawn. A perfect clock is the diagonal. A fast clock runs above it and a slow clock below, and the gap grows with time, which is why synchronisation has to be repeated. From the Tanenbaum figure deck for chapter 5

Two measures to name: skew is the instantaneous difference between two clock readings, and drift rate is the rate at which they diverge. A clock with drift rate ρ obeys

1ρdCdt1+ρ

so two clocks can differ by up to 2ρΔt after time Δt, and a system that must keep them within δ has to resynchronise every δ/(2ρ) seconds. That inequality is the reason clock synchronisation is periodic rather than a one time fix.

Why physical synchronisation is hard, which is asked directly in four sittings:

  • No single correct source is reachable instantly. Reading a remote clock takes a message, and the message takes an unknown time.
  • Message delay is variable. The best you can do is bound it, and on a wide area network the bound is poor.
  • Clocks must never run backwards. A clock that is ahead cannot simply be set back, because a file could then be modified "before" it was created; it must be slowed until it catches down.
  • Crystals drift with temperature and age, so the correction is never permanent.

Internal against external synchronisation, a distinction that decides which algorithm you use. For many applications it is enough that all the machines agree with each other, even if they are all wrong: if every machine believes it is 10:00 when it is really 10:02, a build still works, because only the internal consistency matters. That is internal synchronisation, and Berkeley's algorithm does it. When the clocks must also stay within a bound of real time, that is external synchronisation, and Cristian's method and NTP do it against UTC.

PointPhysical clockLogical clock
What it holdsA count of crystal oscillations, that is real timeA monotonically increasing software counter
PurposeTo tell what time of day an event happenedTo tell the order in which events happened
Needs synchronising with real time?Yes, against UTCNo, it never claims to be a time of day
CostMessages, and accuracy limited by delayA counter and a field on each message
Used forTimestamps on files, certificates, logsOrdering events, mutual exclusion, concurrency control

The international atomic clock, since 2081 Bhadra asks how it was established: a second is defined as 9,192,631,770 transitions of the caesium 133 atom. TAI, International Atomic Time, is the average of over 200 caesium clocks in national laboratories around the world. Because the earth's rotation is slowing, UTC is TAI with leap seconds inserted to keep it within 0.9 seconds of solar time, and UTC is what a time server broadcasts.

Asked on the paper, word for word
  • How did the international atomic clock establish? List the basic principle of Lamport's clock and proposed the approach to avoid issues with Lamport's clock. 2081 Bhadra Q4 · 2+2+4
  • What is the difference between physical and logical clock? Discuss the principles of Lamport's clock with algorithm. 2081 Baishakh Q4 · 2+8
  • What is physical and logical clock? Explain the importance of VECTOR clock with its implementation rules and example. 2080 Baishakh Q4 · 2+4+2
  • Why clock synchronization is necessary? Explain the clock synchronization algorithm using vector clock along with an example. 2074 Ashwin Q5 · 2+6
  • Differentiate between physical clock and logical clock. Why it is difficult to synchronize physical clock? Describe a method for physical clock synchronization. 2072 Chaitra Q5 · 2+2+6
  • Why it is difficult to synchronize physical clock? Explain how clock synchronization can be solved using logical clock. 2072 Kartik Q6 · 2+6
  • What are the common problems of physical clock synchronization algorithms? Write Chandy-Lamport's algorithm for recording global states in Distributed System. 2071 Shrawan Q4 · 3+5
  • What do you mean physical and logical clocks? Explain Network Time Protocol and Berkeley Algorithm for physical clock synchronization. 2070 Chaitra Q6 · 2+4+2
  • Compare physical clocks and logical clocks with its implementation semantics. Describe Lamport's timestamp algorithm with its benefits and drawbacks. 2070 Ashad Q5 · 2+6
  • Define logical and physical clocks. Explain Lamport timestamp algorithm along with an example. 2069 Chaitra Q5 · 2+6

5.2Cristian's method

Ask a time server, and halve the round trip HOT 4/22

76 Ch · 75 Ash · 72 Ch · 72 Ka32+2+62+4

The setting. Cristian's algorithm relies on a time server S that holds UTC from a radio clock or another accurate source. Every other computer stays synchronised by making a procedure call to it. It achieves synchronisation only when the round trip times are short compared with the accuracy required, which is why it suits a local network.

Lecture note figure: Cristian's algorithm on a time line, the client sending a request at T zero, the time server handling the interrupt and stamping the UTC time, and the reply arriving back at the client at T one, both measured on the client's own clock
The exchange. Both T0 and T1 are read from the client's own clock, which is what makes the round trip measurable without any agreement about time. From the Chapter 5 lecture notes

The algorithm, three steps:

  1. Process P requests the time from server S, noting T0 on its own clock.
  2. S prepares a response and appends the time T from its own clock.
  3. P receives the reply at T1 and sets its clock to
Tnew=T+RTT2,RTT=T1T0

The assumption being made, and you should state it: that the round trip is split equally between the request and the response. That is not always true, but it is reasonable on a LAN.

How accurate is it? Let min be the minimum time to send a message one way. The earliest moment S could have written T was min after P sent its request, and the latest was min before the reply arrived. So when P reads the reply, S's clock lies in the range

[T+min,T+RTTmin]

whose width is RTT2min, giving an accuracy of

±(RTT2min)

Improving it: make several requests and keep the reply with the shortest round trip, because that is the one least distorted by queueing.

Worked example, the one in your notes.

  • Request sent at T0=5:08:15.100.
  • Response received at T1=5:08:15.900.
  • Response contains Tserver=5:09:25.300.
  • Round trip =T1T0=800 ms, so the timestamp was made about 400 ms ago.
  • Set the local clock to 5:09:25.300+400 ms=5:09:25.700, with accuracy ±400 ms.

The drawback, and the fix. If the time server fails, synchronisation becomes impossible, and a single server is also a target for attack. The answer is to provide the time from a group of synchronised time servers, which is exactly what NTP does.

Asked on the paper, word for word
  • Write short notes on: Physical Clock Synchronization: Cristain's Algorithm 2076 Chaitra Q9c · 3
  • What is Network Time Protocol (NTP)? How Berkeley minimizes the problems of single time server failures of Chistian's algorithm. 2075 Ashwin Q6 · 2+4
  • Differentiate between physical clock and logical clock. Why it is difficult to synchronize physical clock? Describe a method for physical clock synchronization. 2072 Chaitra Q5 · 2+2+6
  • Write short notes on: Christian's Algorithm 2072 Kartik Q9a · 3

5.3Berkeley's algorithm

Nobody knows the right time, so agree on the average PIN 2/22

75 Ash · 70 Ch2+4+22+4

The situation Berkeley solves. Cristian's method needs a machine that actually knows UTC. Berkeley's algorithm is for a system where no radio clock is present, so there is no way to learn the real time at all. It maintains a global average as the global time, which makes it an internal synchronisation algorithm.

Lecture slide: the Berkeley algorithm in three steps, the time daemon polling every machine for its time, the machines replying with their clock values, and the daemon telling each one how much to adjust its clock by
Three steps. The daemon asks, the machines answer, the daemon returns an adjustment to each one, positive for the slow and negative for the fast. From the Tanenbaum figure deck for chapter 5

The algorithm:

  1. One computer is chosen as the master, also called the time daemon; the rest are slaves.
  2. The master periodically polls the slaves for their time, and they send back their clock values.
  3. The master estimates each slave's local time by observing the round trip times, so that transmission delay does not distort the reading.
  4. The master calculates the average of the values obtained, including its own.
  5. While averaging it eliminates faulty clocks, by choosing a subset of clocks that do not differ from one another by more than a specified amount. This is what stops one wildly wrong machine dragging everybody with it.
  6. The master sends each slave the amount by which it should adjust its clock, which may be positive or negative. Sending the adjustment rather than the time removes the delay of the reply from the result.
  7. If the master fails, one of the slaves is elected to take its place, which is chapter 6's election algorithm doing real work.

Why it "highlights that clocks vary in rate, not only in value": because the master computes an adjustment each round rather than a fixed offset once, it tracks a clock that is consistently fast and keeps correcting it.

PointCristianBerkeley
TypeExternal: synchronises to UTCInternal: synchronises the machines with each other
NeedsA server with an accurate time sourceNo accurate source at all
Who starts itThe client, passively answered by the serverThe master, which polls everybody
What is sent backThe server's timeThe adjustment to apply
Faulty clocksNot handledExcluded from the average
Server failureSynchronisation stopsA slave is elected master

That last row is the answer to "how does Berkeley minimise the problem of single time server failure in Cristian's algorithm" (2075 Ashwin): the master is replaceable by election, and no single machine is the source of truth.

Asked on the paper, word for word
  • What is Network Time Protocol (NTP)? How Berkeley minimizes the problems of single time server failures of Chistian's algorithm. 2075 Ashwin Q6 · 2+4
  • What do you mean physical and logical clocks? Explain Network Time Protocol and Berkeley Algorithm for physical clock synchronization. 2070 Chaitra Q6 · 2+4+2

5.4Network Time Protocol

NTP: a whole network of time servers PIN 3/22

80 Bh · 75 Ash · 70 Ch2+4+22+44

What NTP is. It defines an architecture that lets clients across the internet be synchronised accurately to UTC, by synchronising against many time servers rather than one.

Its four design aims, which is a clean four mark answer:

  • Adjust the system clock close to UTC over the internet.
  • Handle bad connectivity, so a lost server or a congested path does not break synchronisation.
  • Enable frequent resynchronisation, because drift never stops.
  • Security, so that a client cannot be fed a false time by an attacker.
Lecture note figure: the NTP synchronisation subnet as three strata, stratum one servers connected directly to atomic clocks, stratum two servers synchronised from them, and stratum three below that, with peer links drawn between servers of the same stratum
The synchronisation subnet. Stratum 1 servers sit directly on atomic clocks; each lower stratum synchronises from the one above and also peers sideways. The higher the stratum number, the less accurate the clock. From the Chapter 5 lecture notes

The hierarchy. NTP is provided by a network of servers across the internet. Primary servers are connected directly to a time source; secondary servers are synchronised with primaries. The logical hierarchy of connections is the synchronisation subnet, each level of it is a stratum, and the lowest level executes in the user's own workstation. Servers with high stratum numbers are liable to have less accurate clocks, and the subnet reconfigures itself when a server fails.

Three modes of synchronisation, a standard three mark list:

  • Multicast mode: a server periodically multicasts the time to the other servers on the network, which set their clocks assuming a small delay. Cheap, least accurate, used on a fast LAN.
  • Procedure call mode: one server accepts requests from other computers and replies with its timestamp, like Cristian's method. Used where multicast is not available.
  • Symmetric mode: a pair of servers on the higher levels of the subnet exchange messages continually, retaining timing information, to improve the accuracy of their synchronisation over time. Most accurate, most expensive.

How NTP computes the offset

Lecture note figure: an NTP message exchange between processes A and B, the request leaving A at T one, arriving at B at T two, the reply leaving B at T three and arriving back at A at T four
Four timestamps, one exchange. A sends at T1, B receives at T2, B replies at T3 carrying both, and A receives at T4. A now knows all four. From the Chapter 5 lecture notes
  1. A requests the time from B at its own T1.
  2. B receives the request at its T2 and records it.
  3. B responds at its T3, sending the values of T2 and T3.
  4. A receives the response at its T4.

A knows T4T1 from its own clock, and B has reported T2 and T3. The time spent inside B is T3T2, so the total transit time on the network is

d=(T4T1)(T3T2)

Assuming the transit is about the same both ways, one way transit is d/2, so B's clock at the moment A reads T4 was approximately T3+d/2. The offset between the two clocks is therefore

o=(T3+d2)T4=(T2T1)+(T3T4)2

Why this beats Cristian: NTP keeps the last eight pairs of (o,d) and picks the offset whose delay was smallest, because the smallest delay is the least distorted sample. It also filters across several servers, so one bad server is outvoted.

Asked on the paper, word for word
  • Write short notes on: NTP 2080 Bhadra Q10d · 4
  • What is Network Time Protocol (NTP)? How Berkeley minimizes the problems of single time server failures of Chistian's algorithm. 2075 Ashwin Q6 · 2+4
  • What do you mean physical and logical clocks? Explain Network Time Protocol and Berkeley Algorithm for physical clock synchronization. 2070 Chaitra Q6 · 2+4+2

5.5Logical clocks and Lamport's algorithm

Lamport's clock: ordering without a clock TOP 11/22

81 Bh · 81 Ba · 78 Bh · 76 Ch · 76 Ash · 75 Ch · 75 Ash · 73 Shr · 72 Ka · 70 Asa · 69 Ch2+62+82+2+4

Logical clock A virtual clock that records the relative ordering of events in a process. It is a monotonically increasing software counter, used whenever the relative ordering of events matters more than the physical time, and it needs no synchronisation with any other clock.

The starting observation. If two processes never exchange messages, they have no way of affecting each other, so there is no need to order their events at all; such events are concurrent. Events on one machine can be ordered by the local clock. And when two processes do communicate, the send must have happened before the receive. Those three facts are all the ordering that physics gives us, and Lamport's contribution was to say that they are enough.

Happened before, written ab
  • If a and b are events in the same process and a comes first, then ab.
  • For any message m, send(m)receive(m).
  • If ab and bc then ac (transitive).
If ab then a causally affects b. If neither ab nor ba holds, the events are concurrent, written ab.

Partial and total order, two terms the paper uses: the system has a partial order because happened before relates some pairs of events and leaves concurrent pairs unrelated. If a causal relationship can be established among all events, the system has a total order, which is obtained in practice by breaking ties with the process identifier.

The implementation rules

Each process Pi keeps a counter Ci, and obeys three rules:

  1. Before each event in the process, increment the counter: Ci:=Ci+1.
  2. When sending a message, include the counter value with the message: m=(data,t) with t=Ci.
  3. On receiving a message carrying t, set the counter to be greater than the maximum of its own value and the received value before the message is considered received: Cj:=max(Cj,t)+1.
Lecture note figure: two copies of the same three process message diagram stamped with Lamport clocks, the first showing a message that appears to arrive before it was sent and is marked impossible, the second with the receive clock corrected upward so causality holds
Why rule 3 exists. In the left diagram message C is stamped 60 at the sender and arrives at a process whose clock reads only 56, so the receive would be earlier than the send, marked impossible. On the right the receiver's clock has been pushed to 61, and causality holds. From the Chapter 5 lecture notes

The limitation, which is asked as often as the algorithm

The clock guarantees one direction only:

abC(a)<C(b)

but the converse is false. From C(a)<C(b) you cannot conclude ab: the two events may be entirely concurrent and have simply picked up those numbers independently. So Lamport's clock cannot detect causality, only respect it, and that is why it is said not to be a true clock. Two more practical limits: the counters of different processes carry no relation to each other, and total ordering has to be faked with process ids.

The fix is the vector clock, and every paper that asks for "the issue in Lamport's timestamp, and your alternate algorithm" wants exactly that sequence.

Asked on the paper, word for word
  • How did the international atomic clock establish? List the basic principle of Lamport's clock and proposed the approach to avoid issues with Lamport's clock. 2081 Bhadra Q4 · 2+2+4
  • What is the difference between physical and logical clock? Discuss the principles of Lamport's clock with algorithm. 2081 Baishakh Q4 · 2+8
  • Write implementation rules of Lamport clock. State the limitations of Lamport logical clock. 2078 Bhadra Q5 · 6+2
  • What is the issue in Lamport's timestamp? How do you avoid the issue? Explain with your alternate algorithm. 2076 Chaitra Q4 · 2+8
  • Explain Lamport's logical clock with its pros and cons. 2076 Ashwin Q5 · 8
  • List the problems of Lamports clock with example. How vector clock is beneficial than Lamports clock? Explain with implementation rules of vector clock. 2075 Chaitra Q5 · 4+4
  • Write short notes on: Lamport's clock 2075 Ashwin Q11a · 3
  • What do you mean by logical clock? Explain Lamport's Logical clock. 2073 Shrawan Q4b · 2+6
  • Why it is difficult to synchronize physical clock? Explain how clock synchronization can be solved using logical clock. 2072 Kartik Q6 · 2+6
  • Compare physical clocks and logical clocks with its implementation semantics. Describe Lamport's timestamp algorithm with its benefits and drawbacks. 2070 Ashad Q5 · 2+6
  • Define logical and physical clocks. Explain Lamport timestamp algorithm along with an example. 2069 Chaitra Q5 · 2+6

5.6Vector clocks

An array instead of a counter, and now causality is visible HOT 5/22

80 Bh · 80 Ba · 76 Ch · 75 Ch · 74 Ash2+4+22+62+8

Vector clock A clock that gives the ability to decide whether two events are causally related simply by looking at their timestamps. For a system of N processes it is an array of N integers, and each process Pi keeps its own vector Vi to timestamp its local events.

What the entries mean, which makes the rules obvious rather than arbitrary: Vi[i] is the number of events Pi has itself experienced, and Vi[j] is Pi's best knowledge of how many events Pj has experienced. The vector is therefore a summary of everything this process knows about the whole system.

The implementation rules, four steps:

  1. Initially all clocks are zero: Vi[j]=0 for every i,j.
  2. On an internal event, a process increments its own element: Vi[i]:=Vi[i]+1.
  3. On sending a message, it increments its own element and sends the entire vector with the message.
  4. On receiving a message carrying vector t, it increments its own element and then updates every element by taking the maximum: Vj[k]:=max(Vj[k],t[k]) for all k.
Lecture slide: three process time lines with each event stamped by a three element vector clock, and the rules for comparing two vector timestamps for equality, less than and concurrency
Read the rules off the picture. Event c on P1 is (3,0,0): three events of its own, nothing known of the others. Event f is (2,4,1), which says it depends on two events of P1 and one of P3. From the Chapter 5.2 lecture slides, Petru Eles, IDA, LiTH

How to compare two timestamps, which is the part that earns the marks. For vectors u and v:

  • u=v if and only if u[i]=v[i] for every i.
  • uv if and only if u[i]v[i] for every i.
  • u<v if and only if uv and uv.
  • uv, concurrent, if and only if neither u<v nor v<u.

And here is the property Lamport's clock did not have:

abV(a)<V(b)

The implication now runs both ways, so by comparing two timestamps alone you can say whether the events are causally related or concurrent. That is the whole advantage, and it is the answer to "how is the vector clock beneficial over Lamport's clock".

The disadvantage, and you should state it: the timestamp takes storage and message payload proportional to the number of processes, so a system with a thousand processes carries a thousand integers on every message. Lamport's clock costs one integer regardless of size. That trade, causality against payload, is the whole comparison.

Asked on the paper, word for word
  • "Vector timestamp mechanism for synchronization is used for causality of events". Justify with the implementation rules and examples. 2080 Bhadra Q5 · 8
  • What is physical and logical clock? Explain the importance of VECTOR clock with its implementation rules and example. 2080 Baishakh Q4 · 2+4+2
  • What is the issue in Lamport's timestamp? How do you avoid the issue? Explain with your alternate algorithm. 2076 Chaitra Q4 · 2+8
  • List the problems of Lamports clock with example. How vector clock is beneficial than Lamports clock? Explain with implementation rules of vector clock. 2075 Chaitra Q5 · 4+4
  • Why clock synchronization is necessary? Explain the clock synchronization algorithm using vector clock along with an example. 2074 Ashwin Q5 · 2+6

5.7Causal ordering of messages

Delivering messages in the order that makes sense PIN 2/22

80 Bh · 79 Bh4+68

The problem, with the example everyone understands. Someone posts a question to a group, and someone else posts an answer. Because the two messages travel different routes, a third member may receive the answer before the question, which is nonsense. The send of the question happened before the send of the answer, so the delivery must respect that.

Causal ordering If send(m1)send(m2), then every process that receives both must deliver m1 before m2.
Lecture slide: three process time lines with vector timestamps on every message, showing a message that must be delayed at the receiver until the message it causally depends on has been delivered
The protocol in one picture. A message that arrives before the message it causally depends on is held in a buffer, and is delivered only once the missing one has been delivered. From the Chapter 5.2 lecture slides, Petru Eles, IDA, LiTH

The basic idea: a message is delivered to a process only if the message immediately preceding it, in the causal ordering, has already been delivered. Otherwise the message is buffered. Note the word delivered: the message may have arrived long ago and be sitting in a queue; arrival and delivery are different events, and this whole protocol lives in the gap between them.

The implementation, using vector clocks. The protocol is a variant of vector clocks in which the clocks are incremented only for message sending, so Vi[j] counts the messages Pi has seen from Pj:

  1. Before broadcasting a message m, process Pi increments its own element, Vi[i]:=Vi[i]+1, and the timestamp tm carried by m is Vi.
  2. On the receiving side, process Pj delays the delivery of m coming from Pi until both conditions hold:
    tm[i]=Vj[i]+1, meaning this is the very next message expected from Pi, so none has been missed; and
    tm[k]Vj[k] for every ki, meaning Pj has already seen every message that Pi had seen when it sent this one.
  3. Delayed messages are queued at each process, sorted by their vector timestamp, so concurrent messages are ordered by the time they arrived.
  4. When the message is delivered, Pj updates its vector clock by the usual receiving rule.

Read the two conditions in plain words and they stop being frightening: the first says "do not skip a message from this sender", and the second says "do not deliver a reply before the thing it is replying to". The protocol assumes processes communicate by broadcast, and similar protocols exist for non broadcast communication.

Causal ordering is one of three multicast orderings, and the other two, FIFO and total, are in chapter 6.

Asked on the paper, word for word
  • "Vector timestamp mechanism for synchronization is used for causality of events". Justify with the implementation rules and examples. 2080 Bhadra Q5 · 8
  • Define cuts of a distributed computation along with its types. How is casual ordering of message realized using vector clocks? 2079 Bhadra Q4 · 4+6

5.8Global state and cuts

What a global state is, and when a cut is consistent HOT 4/22

81 Bh · 80 Ba · 79 Bh · 73 Shr4+64

Global state The local state of each process, meaning the messages it has sent and received, together with the state of each channel, meaning the messages sent but not yet received.

Why anyone wants it. Several practical jobs need a photograph of the whole system: detecting distributed deadlock, detecting termination of a distributed computation, taking a checkpoint to roll back to after a failure, and distributed debugging, that is checking whether some property held.

Why it is hard. There is no global clock, so the local states are recorded at different moments on different machines. Simply asking every process "what is your state" gives a set of answers taken at different times, which may add up to a situation that never existed.

Lecture slide: a bank with accounts A and B at two sites transferring fifty dollars, drawn in three stages with the money in the account or in the channel, and a table of eight possible global states marked consistent or not consistent
Money in flight. Accounts A and B transfer $50. Record A after the send and B before the receive, and $50 has vanished; the channel state is what accounts for it. The table lists which combinations are consistent. From the Chapter 5.2 lecture slides, Petru Eles, IDA, LiTH

The definitions, exactly as the paper wants them:

Consistent global state A global state is consistent if, for every message received in the state, the corresponding send is also in the state.
Cut, and consistent cut A cut is a subset of the system's history: for each process, all its events up to some point. A cut C is consistent if, for each event it contains, it also contains all the events that happened before that event.
Lecture slide: three process time lines crossed by two cuts, a consistent cut whose every received message has its send inside the cut, and an inconsistent cut where the sender of one message lies outside it
The picture to draw. On the left, every arrow crossing the cut points forward in time, so it is consistent. On the right an arrow crosses backwards: a message is received inside the cut but sent outside it, so the sender cannot be identified with this cut. From the Chapter 5 lecture notes

The types of cut you may be asked to identify:

  • Consistent cut: no message is received inside the cut whose send lies outside it. Drawn as a line that no arrow crosses right to left.
  • Inconsistent cut: at least one message is received inside the cut but sent after it. Such a state never existed and cannot be used as a checkpoint.
  • Strongly consistent cut: a consistent cut that in addition contains no message in transit at all, that is, no arrow crosses it in either direction. Every send inside the cut has its receive inside it too.

The frontier of a cut is the set of the last events at each process, and the state of the cut is the set of local states at that frontier.

Asked on the paper, word for word
  • Write short notes on: Global state and state recording technique 2081 Bhadra Q10a · 4
  • Write short notes on: Strongly Consistent CUT in DS 2080 Baishakh Q9b · 4
  • Define cuts of a distributed computation along with its types. How is casual ordering of message realized using vector clocks? 2079 Bhadra Q4 · 4+6
  • What are the principle applications of state recording and distributed debugging? Determine the types of distributed CUT in the following figure. 2073 Shrawan Q5 · 4+6
In the exam
  • When a figure is given and you must classify the cuts (2073 Shrawan), check one thing only: does any message arrow cross the cut line from right to left? One such arrow makes it inconsistent. No arrows at all crossing makes it strongly consistent.

5.9The Chandy and Lamport snapshot algorithm

Recording a consistent state while the system keeps running PIN 2/22

79 Bh · 71 Shr3+56+4

The trick in one sentence: send a special marker message down every channel; the marker separates the messages that belong in the snapshot from the ones that do not, so nobody ever has to stop.

The four assumptions, which must be stated before the algorithm:

  1. Communication is reliable, so every message sent is eventually received exactly once.
  2. Channels are unidirectional and deliver in FIFO order. This is what makes the marker work as a separator.
  3. The graph of processes and channels is strongly connected, so the marker reaches everybody.
  4. Any process may initiate a snapshot at any time, and the processes continue their normal work throughout.
Lecture slide: the organisation of a process and its incoming and outgoing channels for a distributed snapshot, with the state of the process and the state of each channel marked
What is being recorded. Each process records its own state, and the state of each incoming channel, which is the set of messages in flight on it. From the Tanenbaum figure deck for chapter 5

Marker receiving rule for process Pi, on receipt of a marker over channel c:

  • If Pi has not yet recorded its state: it records its process state; it records the state of c as the empty set; and it turns on the recording of messages arriving over its other incoming channels.
  • Otherwise: it records the state of c as the set of messages it has received over c since it recorded its state.

Marker sending rule for process Pi: after Pi has recorded its state, for each outgoing channel c, it sends one marker over c before it sends any other message over c.

Lecture slide: a process receiving a marker for the first time, recording its local state, sending markers out on all its outgoing channels and starting to record the messages arriving on its other incoming channels
The first marker. A process seeing a marker for the first time records its own state at once, then floods markers out of every outgoing channel before any further traffic. From the Tanenbaum figure deck for chapter 5

Why it produces a consistent state, which is the explanation that turns a recited algorithm into a full answer. Because channels are FIFO and the marker is sent before any other message, every message that arrives on c after the marker was sent by another process is one that process sent after recording its state. So no message can be recorded as received without its send being recorded too, which is precisely the definition of a consistent global state.

Termination: the algorithm finishes when every process has received a marker on every incoming channel. The recorded pieces are then collected to one place and assembled into the global snapshot.

Asked on the paper, word for word
  • Explain snapshot algorithm used for backward recovery in distributed system. Explain three phase commit protocol with state diagram. 2079 Bhadra Q8 · 6+4
  • What are the common problems of physical clock synchronization algorithms? Write Chandy-Lamport's algorithm for recording global states in Distributed System. 2071 Shrawan Q4 · 3+5

5.10Distributed debugging

Asking whether a property ever held PIN 3/22

78 Bh · 73 Shr · 71 Shr44+6

The problem. You want to know whether the system ever entered a bad state, for example two processes in the critical section at once, or the difference between two variables exceeding a bound. No process can see the whole system, and no state can be observed directly, so the question has to be answered from recorded states.

The vocabulary to use:

  • A global predicate is a condition over the global state, such as |x1x2|δ.
  • A predicate is stable if, once true, it stays true. Deadlock and termination are stable, which is why a single snapshot is enough to detect them.
  • Most interesting predicates are unstable: they may be true at one instant and false the next, so a snapshot may simply miss them.

How it is done. Every process sends its state changes, with a vector timestamp, to a monitor process. The monitor builds the lattice of all consistent global states that are compatible with what it received, using the vector timestamps to decide which combinations are consistent. It then evaluates the predicate over that lattice, giving one of two answers:

  • Possibly ϕ: there is a consistent global state in the lattice at which ϕ is true. That is, the system might have passed through it.
  • Definitely ϕ: every path through the lattice from the start to the end passes through a state where ϕ is true, so the system certainly did.

The principal applications of state recording and distributed debugging, asked as a four mark part in 2073 Shrawan: detecting deadlock, detecting termination, checkpointing for recovery, garbage collection of objects no process references, and evaluating safety and liveness properties while the system runs.

Asked on the paper, word for word
  • Write short notes on: Distributed Debugging 2078 Bhadra Q10b · 4
  • What are the principle applications of state recording and distributed debugging? Determine the types of distributed CUT in the following figure. 2073 Shrawan Q5 · 4+6
  • Write short notes on (Any Three): Distributed Debugging 2071 Shrawan Q9d · 4

5.11Last minute recall

Chapter 5 in one screen

  • Three physical algorithms: Cristian (external, one server, T+RTT/2), Berkeley (internal, master averages and sends adjustments), NTP (hierarchy of strata, three modes, offset from four timestamps).
  • Cristian accuracy: ±(RTT/2min). Improve by keeping the shortest round trip.
  • NTP: d=(T4T1)(T3T2), o=12[(T2T1)+(T3T4)]. Modes: multicast, procedure call, symmetric.
  • Happened before: same process order; send before receive; transitive.
  • Lamport rules: increment before an event; send the counter; on receive take max then add one.
  • Lamport limitation: abC(a)<C(b) but not the converse.
  • Vector clock: array of N; increment own element; send the whole vector; on receive take the element wise maximum. abV(a)<V(b). Costs N integers a message.
  • Causal ordering: deliver only when tm[i]=Vj[i]+1 and tm[k]Vj[k] for all other k.
  • Global state = local states plus channel states. Consistent if every receive has its send. Strongly consistent if nothing is in transit.
  • Snapshot: assumptions reliable, FIFO, strongly connected, any initiator. Marker receiving rule and marker sending rule.
  • Stable predicates (deadlock, termination) need one snapshot; unstable ones need possibly and definitely over the lattice.

Chapter 6 · 4 hours · about 9 marks a paper · in 19 of 22 sittings

Coordination and agreement

Many machines, one shared resource, and no shared memory to lock. This chapter builds mutual exclusion out of messages alone, elects a coordinator when one dies, delivers multicast messages in a sensible order, and finally asks the hardest question in the subject: can independent processes agree on anything at all when some of them lie?

What this chapter is about
  • Mutual exclusion by message passing, in two families: permission based (non token) and token based.
  • Five algorithms: central coordinator, Lamport, Ricart-Agrawala, the Ricart-Agrawala token algorithm, and the token ring.
  • Elections: why a coordinator must be replaceable, and the Bully and ring algorithms.
  • Multicast: reliability, and the three delivery orderings.
  • Consensus and the Byzantine generals problem.
Where it fits
  • Timestamps come from chapter 5. Lamport and Ricart-Agrawala both order requests by Lamport clock, so read that card first.
  • Election is used by Berkeley's algorithm in chapter 5 and by passive replication in chapter 7.
  • Consensus is the same problem as atomic commit in chapter 8 and agreement in chapter 9.
What you will learn
  1. 6.1 Mutual exclusion: the problem and the requirements
  2. 6.2 Central coordinator algorithm
  3. 6.3 Lamport's algorithm
  4. 6.4 Ricart-Agrawala algorithm
  5. 6.5 Token based algorithms
  6. 6.6 Token against non token
  7. 6.7 Elections and the Bully algorithm
  8. 6.8 The ring based election algorithm
  9. 6.9 Multicast communication
  10. 6.10 Consensus
  11. 6.11 The Byzantine generals problem
  12. 6.12 Last minute recall, chapter 6
How it is examined
  • The pattern is fixed: a two mark "requirements of mutual exclusion" or "why is election needed", then a six or eight mark algorithm with an example.
  • Ricart-Agrawala and the Bully algorithm are the two most asked, nine sittings each.
  • Count the messages. Every comparison question is really asking for the message cost, so learn 2(N1), 3 and 1 to by heart.

6.1Mutual exclusion in a distributed system

The problem, and the three requirements HOT 5/22

81 Bh · 80 Bh · 73 Shr · 72 Ch · 70 Ch2+62+2+42+8

Why it matters. If two processes are allowed to be in competing critical sections at the same time, the result may be wrong, which is a race condition. Mutual exclusion is the process of ensuring that this destructive interaction does not occur, that is, of allowing only one process into the critical section at a time.

Why a distributed version is needed at all. On one machine you would use a semaphore or a monitor, both of which rest on shared variables and a single kernel. In a distributed system there are no shared variables and no common kernel, so mutual exclusion must be built from message passing alone. That constraint is what makes this chapter interesting.

Three communication scenarios, and only one of them needs it:

  • One way communication usually needs no mutual exclusion at all.
  • Client and server communication: several clients make requests to one shared server. Any coordination is handled by the server, and the clients never interact directly, so again no explicit mutual exclusion is needed.
  • Inter process communication: processes exchange information to reach a conclusion about the system or an agreement among themselves. This is where distributed mutual exclusion is required.

The basic requirements, which is the two mark opener in five sittings:

  • Safety: at most one process may execute in the critical section at a time.
  • Liveness: a process is granted entry if no other process is executing within the critical section, so requests eventually succeed and there is neither deadlock nor starvation.
  • Ordering, or fairness: requests are granted in happened before order, so a request made earlier is served earlier.

The two families of algorithm:

  • Non token based, also called permission based. Each process freely and equally competes for the right to use the resource, and requests are arbitrated either by a central control site or by distributed agreement. This family holds the central coordinator, Lamport and Ricart-Agrawala algorithms.
  • Token based. A logical token representing the access right is passed in a regulated fashion among the processes, and whoever holds it may enter. This family holds the Ricart-Agrawala second algorithm and the token ring algorithm.

How the algorithms are measured, because every comparison question uses these three: the number of messages per entry and exit, the client delay before entry, and the synchronisation delay between one process leaving and the next entering.

Asked on the paper, word for word
  • What are the fundamental requirements of Mutual Exclusion in DS? Why is election applicable in DS? Explain the functional steps of anyone election algorithm. 2081 Bhadra Q5 · 2+2+4
  • Define mutual exclusion in distributed system. Explain the steps to elect coordinator in process resilience system. 2080 Bhadra Q6 · 2+6
  • Define distributed coordination in DS? Explain how token ring algorithm works for mutual exclusion in DS. 2073 Shrawan Q6 · 2+6
  • What are the basic requirements for mutual exclusion in distributed system? Explain the non-token based distributed mutual exclusion algorithm and compare it with token based algorithm. 2072 Chaitra Q6 · 2+8
  • How does mutual exclusion help in co-ordination in distributed system? Explain the way how Lamport algorithm ensures mutual exclusion? 2070 Chaitra Q7 · 2+6

6.2Central coordinator algorithm

Ask one machine for permission PIN 3/22

81 Ba · 79 Bh · 74 Ash358

The idea. A single central coordinator grants permission to enter the critical section. Any process that wants in must take permission from it. The scheme is simple, easy to implement, and needs only three messages per use of the critical section: request, OK and release.

Lecture note figure: the central coordinator algorithm in three panels, process one requesting and being granted the critical section, process two requesting and being queued, and process one releasing so the queued request is granted
The three panels. P1 asks and is granted; P2 asks while P1 is inside, so its request is queued and no reply is sent; P1 releases, and the coordinator then sends OK to P2 from the queue. From the Chapter 6 lecture notes

The algorithm:

  1. To enter the critical section, a process sends a request message to the coordinator and then waits for a reply. During this wait it may continue with other work.
  2. The reply from the coordinator gives the right to enter.
  3. After finishing in the critical section the process notifies the coordinator with a release message.

The coordinator keeps a queue of pending requests. When it is busy, it does not reply at all rather than refusing, so the requester simply blocks; on receiving a release it takes the head of the queue and replies to it.

AdvantagesDisadvantages
Easy to implementPerformance may degrade: the coordinator is a bottleneck
Only three messages per access of the critical sectionIf the coordinator crashes, a new one must be created using an election algorithm
Fair, since the queue preserves orderA process cannot distinguish a dead coordinator from a busy one

That second disadvantage is why election algorithms exist, and it is the link the paper asks for in "coordinator election process in central coordinator algorithm".

Asked on the paper, word for word
  • Write short notes on: Center coordinator algorithm and its issues 2081 Baishakh Q8b · 5
  • Write short notes on: Coordinator election process in central coordinator algorithm 2079 Bhadra Q9c · 3
  • Describe non-token based centralized and Ricart Agrawala algorithm with example and compare them. 2074 Ashwin Q6 · 8

6.3Lamport's algorithm

Every process keeps the queue, ordered by timestamp PIN 1/22

70 Ch2+6

The idea. Lamport's algorithm is permission based, and it uses timestamps to order the requests and to resolve conflicts between them: a request with a smaller timestamp is served first. Every site keeps its own copy of the request queue, so no single machine is in charge.

What it assumes and uses: three message types, REQUEST, REPLY and RELEASE; communication channels that deliver in FIFO order; a timestamp on each request from Lamport's logical clock; and a queue request\_queuei at each site Si, ordered by timestamp.

To enter the critical section:

  • When site Si wants to enter, it sends REQUEST(tsi,i) to all other sites and places its own request on request\_queuei.
  • When site Sj receives that request, it returns a timestamped REPLY to Si and places Si's request on its own queue.

To execute the critical section, Si may enter when both conditions hold:

  • It has received a message with a timestamp larger than (tsi,i) from every other site, and
  • its own request is at the top of request\_queuei.

To release the critical section:

  • Si removes its own request from the top of its queue and sends a timestamped RELEASE message to all other sites.
  • Each site Sj receiving it removes Si's request from its queue.

Cost: 3(N1) messages per entry, that is N1 requests, N1 replies and N1 releases. The second condition is what makes it safe: because every site holds the same queue ordered the same way, only the site whose request is at the top can be first.

Asked on the paper, word for word
  • How does mutual exclusion help in co-ordination in distributed system? Explain the way how Lamport algorithm ensures mutual exclusion? 2070 Chaitra Q7 · 2+6

6.4Ricart-Agrawala algorithm

Drop the release message, and defer the reply instead HOT 6/22

79 Bh · 78 Bh · 75 Ash · 74 Ash · 72 Ch · 71 Shr2+62+84+5

What changed from Lamport. Ricart and Agrawala's algorithm is an extension and optimisation of Lamport's: it uses only two message types, REQUEST and REPLY, and no RELEASE. The trick is that a site which cannot grant permission simply defers its reply, and sends it later when it leaves the critical section. That deferred reply does the job the release message used to do.

Lecture slide: the Ricart and Agrawala distributed algorithm in three panels, two processes requesting the critical section at once, the one with the smaller timestamp being allowed in while the other defers its reply, and the reply being sent when the first leaves
The three states of the exchange. Two processes request at once; the one with the smaller timestamp gets both replies and enters; the other holds its reply back until it is done. From the Tanenbaum figure deck

To enter the critical section:

  • When site Si wants to enter, it sends a timestamped REQUEST to all other sites.
  • When site Sj receives it, it sends a REPLY to Si if and only if Sj is neither requesting nor currently executing the critical section, or Sj is requesting but the timestamp of Si's request is smaller than its own. Otherwise the request is deferred.

To execute: Si enters when it has received a REPLY from all other sites.

To release: on exiting, Si sends a REPLY to all the requests it deferred.

Cost: 2(N1) messages per entry, namely N1 requests and N1 replies, which is a third less than Lamport's algorithm.

The problems, asked as "measure the performance issue" in 2071 Shrawan:

  • Message traffic is expensive: 2(N1) messages for every single entry, and every process must be involved even though only one resource is contended.
  • The failure of any one process blocks progress, because entry needs a reply from every other site, so one dead machine stops the system. There are now N points of failure instead of one.

The alternate algorithm that addresses both is the token based algorithm, which is exactly what that question wants next.

Asked on the paper, word for word
  • Explain with example how can you achieve consensus in distributed system. Explain ricart-agrawala token based algorithm. 2079 Bhadra Q5 · 4+6
  • Compare and contrast token based mutual exclusion algorithm and non-token based mutual exclusion algorithm. Explain the various state of Ricart Agrawala token based mutual exclusion. 2078 Bhadra Q6 · 4+5
  • What is the need of an election algorithm? Explain non token based Ricart-Agrawala mutual exclusion algorithm along with an example. 2075 Ashwin Q7 · 2+6
  • Describe non-token based centralized and Ricart Agrawala algorithm with example and compare them. 2074 Ashwin Q6 · 8
  • What are the basic requirements for mutual exclusion in distributed system? Explain the non-token based distributed mutual exclusion algorithm and compare it with token based algorithm. 2072 Chaitra Q6 · 2+8
  • Measure the performance issue of non-token based Ricart-Agrawal Algorithm. Write alternate algorithm to address those performance issues. 2071 Shrawan Q5 · 2+6

6.5Token based algorithms

Whoever holds the token may enter HOT 4/22

75 Ch · 73 Shr · 71 Ch · 71 Shr2+610

The principle. A single token represents the right to use the resource. It is passed among the processes, and a process enters its critical section only while it holds the token. Safety is then free: there is one token, so there can be one process inside.

Ricart-Agrawala second algorithm

A process that wants the token sends a request to all the other processes competing for the resource. The request carries the requesting process's timestamp from its logical clock and its identifier. The token is initially given to one process arbitrarily.

The data each side keeps, and why:

  • Each process Pi records in requestPi[j] the timestamp of the last request it received from Pj.
  • The token itself carries token[j], the timestamp of Pj's last holding of the token.
  • So Pj has a pending request exactly when requestPi[j]>token[j]: it has asked more recently than it was last served. That one comparison is the whole bookkeeping.
Lecture note figure: the three states of a process in the token based algorithm, no token, token held and token present, with the transitions between them labelled by what causes each one
The three states. NO TOKEN, TOKEN PRESENT (holding it but not using it) and TOKEN HELD (inside the critical section). Note the self loop: a process holding the token can re-enter without any messages at all. From the Chapter 6 lecture notes

The four rules:

  1. Initialisation: every process is in state NO-TOKEN except one, Px, which is TOKEN-PRESENT. All entries of token[] and request[] start at zero.
  2. Requesting and entering: if Pi has no token it sends a request (TPi,i) to all processes and waits until the token arrives; then it becomes TOKEN-HELD and enters. If it already holds the token it enters at once.
  3. Handling an incoming request (TPj,j): set request[j]:=max(request[j],TPj), and if this process is TOKEN-PRESENT, release the resource.
  4. Releasing: search k in the order [i+1,i+2,,n,1,2,,i1]; for the first k with request[k]>token[k], set token[i] to the local clock, become NO-TOKEN, send the token to Pk and stop searching. If nobody is waiting, Pi keeps the token.

Advantages: it needs only N1 requests and one reply, and the failure of a process that is not holding the token does not prevent progress. Also, a process that keeps the token can re-enter the critical section with zero messages.

Token ring algorithm

Lecture note figure: n processes P1 to Pn arranged in a logical ring, each with one neighbour clockwise
The logical ring. The physical network need not be a ring at all; each process simply agrees who its clockwise neighbour is. From the Chapter 6 lecture notes

The algorithm, in three lines:

  1. The token is initially given to one process.
  2. When a process needs the critical section, it waits until it gets the token from its left neighbour and retains it; after leaving the critical section it passes the token to its neighbour in the clockwise direction.
  3. If a process gets the token but does not need the critical section, it immediately passes it along the ring.

The problems:

  • It adds load to the network, because the token keeps circulating even when no process wants it.
  • If one process fails, no progress is possible until the faulty process is removed from the ring.
  • If the process holding the token fails, the token is lost, so an election must be run to generate a new one.

Its delay is unbounded in the worst case: a process that has just passed the token on must wait for it to travel all the way round, so entry can cost up to N1 hops even when nobody else wants it.

Asked on the paper, word for word
  • How token system works for mutual exclusion in Distributed System. Explain with token based Algorithm. 2075 Chaitra Q6 · 2+6
  • Define distributed coordination in DS? Explain how token ring algorithm works for mutual exclusion in DS. 2073 Shrawan Q6 · 2+6
  • Explain with algorithmic steps, how token ring algorithm works for mutual exclusion in distributed system. 2071 Chaitra Q6 · 10
  • Measure the performance issue of non-token based Ricart-Agrawal Algorithm. Write alternate algorithm to address those performance issues. 2071 Shrawan Q5 · 2+6

6.6Token against non token

The comparison, with the message counts PIN 3/22

80 Ba · 78 Bh · 72 Ch2+2+62+84+5

This is asked in three sittings, usually as "compare and contrast". Give the conceptual difference first, then the table.

PointNon token (permission based)Token based
Basis of entryPermission collected from othersPossession of a unique token
How safety is assuredBy the rules for granting permissionBy there being exactly one token
OrderingBy timestamps from a logical clockBy the order the token is passed
Messages per entryLamport 3(N1), Ricart-Agrawala 2(N1)N1 plus one, or 0 if the token is already held
Traffic when idleNoneThe ring token circulates continuously
Effect of a crashOne dead process blocks everybody, since its reply never comesHarmless unless it was holding the token, and then the token must be regenerated
Main riskMessage overhead and N points of failureToken loss and token duplication
Lecture slide: a table comparing the centralized, distributed and token ring mutual exclusion algorithms by the number of messages needed per entry and exit, the delay before entry, and what happens when a process crashes
The standard comparison table. Messages per entry and exit, delay before entry in message times, and the problem each algorithm suffers. From the Tanenbaum figure deck

The three algorithms side by side, the figures to quote:

  • Centralized: 3 messages, delay of 2 message times, and the coordinator can crash.
  • Distributed (Ricart-Agrawala): 2(N1) messages, delay of 2(N1) message times, and the crash of any process is fatal.
  • Token ring: between 1 and messages, delay between 0 and N1, and the token can be lost.
Asked on the paper, word for word
  • Compare non token and token based mutual exclusion. Why election is important in DS? Explain the Ring Based election algorithm with rules and example. 2080 Baishakh Q5 · 2+2+6
  • Compare and contrast token based mutual exclusion algorithm and non-token based mutual exclusion algorithm. Explain the various state of Ricart Agrawala token based mutual exclusion. 2078 Bhadra Q6 · 4+5
  • What are the basic requirements for mutual exclusion in distributed system? Explain the non-token based distributed mutual exclusion algorithm and compare it with token based algorithm. 2072 Chaitra Q6 · 2+8

6.7Elections and the Bully algorithm

Choosing a new coordinator when the old one dies TOP 9/22

81 Bh · 81 Ba · 80 Bh · 79 Bh · 76 Ch · 75 Ash · 71 Ch · 70 Asa · 69 Ch2+62+2+42+4

Leader election The process of designating a single process as the organiser of a task distributed among several nodes. Before it runs, no node knows which will be the leader; after it runs, every node recognises the same unique node as the leader.

Why an election is needed, which is a two or three mark part in five sittings. Give the three concrete places it is used, not a general sentence:

  • Clock synchronisation: Berkeley's algorithm needs a master to average the times, and a new one if the master fails.
  • Mutual exclusion: the central coordinator algorithm needs a coordinator at start up and whenever it crashes, and the token ring algorithm needs a new process elected to generate a fresh token when the token holder fails.
  • Any distributed computing: a distributed algorithm does not assume a central coordinator already exists, so a master must be chosen to distribute the sub problems among the slaves and collect the partial results.

The two phases of any election algorithm: select a leader with the highest priority, then inform all processes about the winner.

The Bully algorithm

Its assumption: the system is synchronous and uses timeouts to identify process failure. Its rule: the process with the highest identifier wins, and a higher numbered process will bully a lower numbered one out of the coordinator position as soon as it comes back online, which is where the name comes from.

Its three message types: Election, sent to announce an election; Answer, sent in response to an election message; and Coordinator, sent to announce the identity of the elected process.

Lecture note figure: the first three steps of the bully algorithm, process four sending election messages to the higher numbered processes, processes five and six answering to stop it, and five and six each holding their own election
Steps a to c. (a) Process 4 notices the coordinator 7 has crashed and holds an election, messaging only the higher numbers. (b) 5 and 6 answer, telling 4 to stop. (c) 5 and 6 now each hold their own election. From the Chapter 6 lecture notes
Lecture note figure: the last two steps of the bully algorithm, process six telling five to stop, and process six winning and sending a coordinator message to every other process
Steps d and e. (d) 6 answers 5, telling it to stop. (e) 6 hears from nobody higher, so it wins and sends a coordinator message to everyone. From the Chapter 6 lecture notes

The algorithm as rules:

  1. Rule for the initiator. Set state to ELECTION-ON; send an election message to every process with a higher identifier; wait for an answer. If no answer arrives before the timeout, this process is the coordinator and sends a coordinator message to all processes. Otherwise it waits for a coordinator message, and if none arrives before a timeout it restarts the election.
  2. Rule for handling an incoming election message from Pj: reply with an answer message to Pj, and if this process is not already in an election, start its own election procedure.

Cost. In the best case the process with the second highest identifier notices the failure first; it finds nobody above it, declares itself and sends N2 coordinator messages. In the worst case the process with the lowest identifier starts, sending N1 election messages to processes that each start their own election, giving O(N2) messages.

Asked on the paper, word for word
  • What are the fundamental requirements of Mutual Exclusion in DS? Why is election applicable in DS? Explain the functional steps of anyone election algorithm. 2081 Bhadra Q5 · 2+2+4
  • How do you elect replica manager in primary backup replication? Explain. 2081 Baishakh Q5 · 10
  • Define mutual exclusion in distributed system. Explain the steps to elect coordinator in process resilience system. 2080 Bhadra Q6 · 2+6
  • Write short notes on: Coordinator election process in central coordinator algorithm 2079 Bhadra Q9c · 3
  • How does a new coordinator elect in executing central coordinator algorithm? How to come to consensus in DS? Explain. 2076 Chaitra Q5 · 5+5
  • What is the need of an election algorithm? Explain non token based Ricart-Agrawala mutual exclusion algorithm along with an example. 2075 Ashwin Q7 · 2+6
  • Write the importance of election algorithm. Explain BULLY algorithm with suitable example. Compare it with Ring based algorithm. 2071 Chaitra Q4 · 8
  • Explain any one election technique in Distributed System. Discuss with steps how consensus can be achieved in Distributed System. 2070 Ashad Q6 · 5+3
  • Present a practical scenario where you need an election algorithm. Explain an election algorithm with example that is suitable to your scenario. 2069 Chaitra Q6 · 2+4

6.8The ring based election algorithm

Chang and Roberts: pass the identifier round the ring PIN 2/22

80 Ba · 71 Ch2+2+68

What it assumes. The processes are arranged in a logical or physical ring. The algorithm works for any number of processes and does not require any process to know how many there are, which is its main advantage over the Bully algorithm.

Lecture slide: an election in a ring, the election message travelling clockwise collecting process identifiers, and the coordinator message going round announcing the highest one
Two circuits. The election message goes round once collecting identifiers, and the coordinator message goes round again announcing the winner. From the Tanenbaum figure deck

The algorithm:

  1. Initially every process is marked non participant.
  2. A process that notices the lack of a leader starts an election: it creates an election message containing its own UID and sends it clockwise to its neighbour.
  3. Every time a process sends or forwards an election message it marks itself a participant.
  4. When a process receives an election message it compares the UID in it with its own:
    • If the UID in the message is larger, it forwards the message unchanged, clockwise.
    • If the UID is smaller and the process is not yet a participant, it replaces the UID with its own and forwards it.
    • If the UID is smaller and the process is already a participant, it discards the message. This is the step that stops the ring filling with duplicate elections.
    • If the UID equals its own, that process has seen its own identifier come all the way round, so it is the leader.
  5. The new leader marks itself non participant and sends an elected message round the ring with its UID. Each process receiving it marks itself non participant, records the elected UID and forwards the message. When it returns to the leader, the leader discards it and the election is over.

Message cost:

  • Average case: about N/2 messages to reach the maximal node, N to return to it, and N for the elected message, giving 2N+N/2.
  • Worst case: N1 messages to reach the maximal node, giving 3N1 in total.
PointBullyRing based
TopologyFully connected, every process can reach every otherA logical ring, each process knows only its neighbour
Needs to know N?Yes: it must know who is higher than itselfNo
MessagesO(N2) worst case3N1 worst case
SpeedFaster, because it only contacts higher processesSlower, two full circuits
Failure during the electionHandled by timeouts and restartingA failed process breaks the ring and it must be repaired
AssumptionSynchronous system with reliable timeoutsReliable FIFO ring, no timing assumption
Asked on the paper, word for word
  • Compare non token and token based mutual exclusion. Why election is important in DS? Explain the Ring Based election algorithm with rules and example. 2080 Baishakh Q5 · 2+2+6
  • Write the importance of election algorithm. Explain BULLY algorithm with suitable example. Compare it with Ring based algorithm. 2071 Chaitra Q4 · 8

6.9Multicast communication

Sending to a group, reliably and in the right order PIN 3/22

76 Ash · 75 Ash · 67 Mng38

Why groups need their own primitive. Sending the same message to N processes by N separate calls is slow and, worse, is not atomic: the sender may crash halfway, so some members act on the message and others never see it. A multicast primitive exists to make the operation efficient and to give delivery guarantees.

The vocabulary: a group is closed if only members can multicast to it, and open otherwise; a group is static if membership is fixed and dynamic if processes may join and leave.

Basic multicast, B-multicast: send the message to every member of the group, usually by a loop of reliable one to one sends. It delivers the message if the sender survives, and gives nothing if it does not.

Reliable multicast, R-multicast, requires three properties, and these are worth memorising because the question asks for "properties":

  • Integrity: a correct process delivers a message at most once, and only if it was actually sent to the group.
  • Validity: if a correct process multicasts a message, it will eventually deliver it itself.
  • Agreement: if a message is delivered to one correct process, then all correct processes in the group will deliver it. This is the all or nothing property, and it is what B-multicast lacks.

The algorithm that achieves it, and it is three lines:

  1. On initialisation each process sets Received:={}.
  2. To R-multicast a message m to group g, a process B-multicasts it.
  3. On B-delivering m, a process checks whether m is in Received. If not, it adds m to Received, B-multicasts m again itself if it was not the original sender, and only then R-delivers m.

The re-multicast is what buys agreement: if any correct process delivered the message, it has also forwarded it to everybody, so the death of the original sender cannot leave a member without it. The cost is that each message travels N times more than necessary, which is why practical systems use negative acknowledgements instead.

Feedback suppression, asked as its own short note (2075 Ashwin). The problem is the feedback implosion: if every one of a thousand receivers acknowledges every message, the sender drowns. So a scalable reliable multicast uses negative acknowledgements, sent only when a receiver notices a gap in the sequence numbers, and it multicasts that NACK to the whole group rather than to the sender. Every other receiver that was about to report the same gap sees the NACK already in flight and suppresses its own. A random delay before sending makes it unlikely that two receivers report at the same instant. The result is roughly one NACK per lost message however many receivers there are, which is what makes the scheme scale.

Ordered multicast

Textbook figure: three process time lines carrying messages labelled T, F and C, showing totally ordered messages delivered in the same order everywhere, FIFO ordered messages from one sender, and causally related messages
Three orderings on one picture. The T messages are totally ordered, the F messages are FIFO ordered from one sender, and the C messages are causally related. From the Distributed Systems lecture notes
  • FIFO ordering: if a correct process multicasts m1 before m2, then every correct process that delivers both delivers m1 first. It orders only the messages of one sender.
  • Causal ordering: if the multicast of m1 happened before the multicast of m2, then every correct process delivers m1 first. It is implemented with vector clocks, as in chapter 5, and it implies FIFO ordering.
  • Total ordering: if a correct process delivers m1 before m2, then every correct process delivers them in that same order. Note that total ordering says nothing about which order, only that everyone agrees.

Two ways to get total ordering: a sequencer process assigns a global sequence number to every message, which is simple and makes the sequencer a bottleneck; or the processes collectively agree on the identifiers, which is the ISIS algorithm.

Textbook figure: the ISIS algorithm for total ordering, a process multicasting a message, every receiver returning a proposed sequence number, and the sender multicasting the largest of them back as the agreed sequence
ISIS in three steps. The sender multicasts; every receiver proposes a sequence number larger than any it has seen; the sender picks the largest proposal and multicasts it back as the agreed sequence. From the Distributed Systems lecture notes

Why ISIS works: messages sit in a hold back queue, provisionally ordered by their proposed number and marked undeliverable, and are released in order only once their agreed number is known. Because the agreed number is the maximum of all proposals, no later message can ever be given a smaller one.

Asked on the paper, word for word
  • Explain reliable multicast with its properties and an algorithm. 2076 Ashwin Q6 · 8
  • Write short notes on: Feedback suppression mechanism in M-cast communication 2075 Ashwin Q11c · 3
  • Explain any 3 of the following: Use of multicast communication in Distributed systems 2067 Mangsir Q8a · 3

6.10Consensus

Getting independent processes to decide the same thing HOT 5/22

79 Bh · 78 Bh · 76 Ch · 71 Shr · 70 Asa3+43+54+6

Consensus Every process Pi begins in an undecided state and proposes a value vi. The processes exchange messages, and each one eventually sets a decision variable di and enters the decided state, after which the value cannot change.
Lecture slide: the consensus problem drawn as three processes proposing values by unreliable multicast, each having to decide on the same value
Step one, propose. Each process multicasts its own value to the others over an unreliable channel. Everything after this is the work of turning three different proposals into one decision. From the Chapter 6 coordination and consensus slides
Textbook figure: consensus for three processes, two proposing to proceed and one proposing to abort before crashing, with the two surviving processes deciding to proceed
Consensus with a crash. Two processes propose proceed, one proposes abort and then crashes. The two survivors must still both decide, and decide the same thing. From the Distributed Systems lecture notes

The three requirements, which are the marks in any "how is consensus achieved" question:

  • Termination: eventually every correct process sets its decision variable.
  • Agreement: the decision value of all correct processes is the same: if Pi and Pj are correct and have decided, then di=dj.
  • Integrity: if all the correct processes proposed the same value, then any correct process in the decided state has chosen that value.

How it is achieved in a synchronous system with crash failures. The standard algorithm runs in f+1 rounds, where f is the maximum number of processes that may fail:

  1. Each process keeps a set of the values it has seen, starting with its own proposal.
  2. In each round, every process multicasts the values it has newly learned to all the others, and adds to its set every value it receives.
  3. After f+1 rounds, every process applies the same deterministic function to its set, for example minimum, and that is the decision.

Why f+1 rounds: at most f processes can fail, so at least one round must be one in which no process failed, and in that round everybody's set became identical. It is the same value function applied to the same set, so the decisions agree.

The result you must quote: the Fischer, Lynch and Paterson theorem, 1985. No consensus algorithm can be guaranteed to terminate in an asynchronous system if even one process may crash, because no process can distinguish a crashed process from a slow one. That is not a defect of any particular algorithm; it is a proof that none can exist.

What practical systems do about it, and this is the mark that separates a good answer: they weaken one requirement. They use timeouts and failure detectors to pretend the system is synchronous; they accept probabilistic termination, as Paxos and Raft do, which are always safe and only eventually live; or they use masking by replication so that agreement is not needed on every step.

Related problems, since papers name them: Byzantine generals, where one commander supplies the value and others may lie, and interactive consistency, where the processes must agree on a vector of values, one per process.

Asked on the paper, word for word
  • Explain with example how can you achieve consensus in distributed system. Explain ricart-agrawala token based algorithm. 2079 Bhadra Q5 · 4+6
  • Discuss how Consensus can be achieved in Distributed System. Explain the check pointing approach for distributed recovery. 2078 Bhadra Q8 · 3+4
  • How does a new coordinator elect in executing central coordinator algorithm? How to come to consensus in DS? Explain. 2076 Chaitra Q5 · 5+5
  • How to come to consensus in DS? Discuss with an approach, how do you make the distributed system service highly available? 2071 Shrawan Q6 · 3+5
  • Explain any one election technique in Distributed System. Discuss with steps how consensus can be achieved in Distributed System. 2070 Ashad Q6 · 5+3

6.11The Byzantine generals problem

Agreement when some of the participants lie HOT 6/22

81 Ba · 80 Bh · 75 Ch · 71 Ch · 70 Ch · 70 Asa1+2+52+2+42+8

The story, which is also the specification. Three or more generals must agree to attack or to retreat. One general, the commander, issues the order; the others, the lieutenants, must decide what to do. One or more of the generals may be treacherous: a traitorous general may tell one lieutenant to attack and another to retreat. The difference from plain consensus is that here a single process supplies the value to agree on.

The requirements:

  • Termination: eventually each correct process sets its decision variable.
  • Agreement: the decision value of all correct processes is the same.
  • Integrity: if the commander is correct, then all correct processes decide on the value the commander proposed. If the commander is faulty, they must still agree on something, but it need not be what the commander said.
Lecture slide: the impossibility result with three byzantine generals, a commander sending conflicting orders to two lieutenants who cannot tell which of the other two is lying
Why three is impossible. Whether the commander is the traitor or the other lieutenant is, a correct lieutenant sees exactly the same two messages. It has no way to tell the cases apart, so no rule can make it decide correctly in both. From the Chapter 6 coordination and consensus slides

The impossibility with three generals. Suppose the commander says "attack" to lieutenant 1 and "retreat" to lieutenant 2. Each lieutenant reports what it heard to the other. Lieutenant 1 now holds two contradictory values, one from the commander and one from lieutenant 2, and cannot tell whether the commander lied or lieutenant 2 did. A majority of two conflicting values does not exist, so there is no correct rule.

Lecture slide: the solution with four byzantine generals, where each lieutenant forwards what it received to the others and the majority of the three reported values gives the correct order
Why four works. With three lieutenants, a correct one receives the commander's value plus two reports. Two of those three come from correct processes, so a majority vote gives the right answer whichever single process is faulty. From the Chapter 6 coordination and consensus slides

The solution with four generals, that is one commander and three lieutenants with at most one traitor:

  1. The commander sends its value to each of the three lieutenants.
  2. Each lieutenant forwards the value it received to the other two lieutenants.
  3. Each lieutenant now holds three values: the one from the commander and two reports. It takes the majority of those three.

If the commander is correct, all three lieutenants received the same value, so the majority is that value even though the traitor reported something else. If the commander is the traitor, the three correct lieutenants each hold the same multiset of three values, so their majorities agree with one another, which is all agreement requires.

The bound to quote A solution exists if and only if fewer than one third of the processes are faulty. With f faulty processes, at least 3f+1 processes in total are needed, and the algorithm takes f+1 rounds.

What it teaches, which is the phrasing 2075 Chaitra uses. Three things: agreement is possible even with malicious participants, but only if they are a small enough minority; the cost is high, since the message complexity is exponential in the number of rounds for the classic algorithm; and redundancy alone is not enough, because it is the ratio of faulty to correct processes that decides whether agreement is reachable at all.

Asked on the paper, word for word
  • What is byzantine problem? Explain the backward recovery approaches in DS. 2081 Baishakh Q6 · 2+8
  • Define faults, failures and errors. How to achieve agreement in faulty system over reliable channel? Explain. 2080 Bhadra Q9 · 4+4
  • What do you learn from Byzantine generals problem? Explain the basic principle of K-fault tolerant. 2075 Chaitra Q9 · 3+5
  • Explain Byzantine general problem to handle faulty process with example. Describe any one failure recovery technique. 2071 Chaitra Q7 · 8
  • What do you mean by fault tolerant system? What do you mean by Byzantine Failure? Explain Byzantine Generals problem to illustrate how agreement can be reached in faulty system. 2070 Chaitra Q10 · 1+2+5
  • What are the dependability requirements of fault tolerant system? What do you mean by K-fault tolerant? How to come agreement in faulty system? Explain with the approach of byzantine generals problem. 2070 Ashad Q9 · 2+2+4

6.12Last minute recall

Chapter 6 in one screen

  • Requirements: safety (one at a time), liveness (no deadlock or starvation), ordering (happened before order).
  • Central coordinator: request, OK, release. 3 messages. Coordinator is a bottleneck and a single point of failure.
  • Lamport: REQUEST, REPLY, RELEASE, a queue at every site, enter when your request is at the top and you have a larger timestamp from everybody. 3(N1) messages.
  • Ricart-Agrawala: REQUEST and REPLY only, defer the reply instead of releasing. 2(N1) messages. Any crash blocks it.
  • Token based: one token, three states, request[j]>token[j] means a pending request. N1 plus one message, and zero if you hold the token.
  • Token ring: pass clockwise, hold it if you need it. Load even when idle, and failure breaks the ring.
  • Election is needed by Berkeley, the central coordinator, the token ring, and any master and slave computation.
  • Bully: election, answer, coordinator. Best case N2 messages, worst case O(N2). Needs a synchronous system with timeouts.
  • Ring (Chang and Roberts): participant flag, forward the larger UID, two circuits. Worst case 3N1.
  • R-multicast properties: integrity, validity, agreement. Orderings: FIFO, causal, total. Total by sequencer or by ISIS.
  • Feedback suppression: NACK multicast to the whole group, after a random delay, so duplicate reports are suppressed.
  • Consensus: termination, agreement, integrity. f+1 rounds in a synchronous system. FLP: impossible to guarantee in an asynchronous system with one crash.
  • Byzantine: impossible with three, works with four, needs 3f+1 processes and f+1 rounds.

Chapter 7 · 4 hours · about 6 marks a paper · in 18 of 22 sittings

Replication

Keep more than one copy of the data, and three good things happen: it is faster, it stays available when a machine dies, and the service survives faults. One bad thing happens too, and the whole chapter is about paying for it: the copies have to agree. Every paper sets a question here, usually active against passive replication.

What this chapter is about
  • Why replicate: performance, availability, fault tolerance, and the arithmetic behind the availability claim.
  • The system model: front ends, replica managers and the five phases every request goes through.
  • Two models: active replication, where every replica does the work, and passive, where one primary does it and tells the others.
  • Consistency models, from strict down to entry consistency.
  • High availability through gossip, and transactions on replicated data.
Where it fits
  • Active replication needs totally ordered multicast from chapter 6, and passive replication needs its election algorithm.
  • Gossip uses the vector timestamps of chapter 5.
  • The fault classes here are the short version of chapter 9.
What you will learn
  1. 7.1 Reasons for replication, and how it is done
  2. 7.2 The system model and the five phases
  3. 7.3 Object replication and concurrent invocations
  4. 7.4 Replication as a scaling technique
  5. 7.5 Active replication
  6. 7.6 Passive replication, the primary backup model
  7. 7.7 Fault tolerant services and consistency models
  8. 7.8 Highly available services and gossip
  9. 7.9 Transactions with replicated data
  10. 7.10 Last minute recall, chapter 7
How it is examined
  • Active against passive is the question, in ten of the twenty two sittings. Draw both diagrams and give the five phases for each.
  • The opener is always "reasons for replication" or "requirements and challenges", worth two to four marks.
  • "A technique that makes the service highly available" means gossip. Three sittings ask for it by that phrasing.

7.1Reasons for replication

Three reasons, three ways, one problem TOP 8/22

81 Bh · 80 Bh · 79 Bh · 78 Bh · 73 Shr · 72 Ch · 72 Ka · 70 Ch3+52+3+32+4+2

Replication The maintenance of multiple copies of data at multiple computers, which makes a distributed system more effective by enhancing performance, availability and fault tolerance.

1. Performance enhancement. A copy placed close to the process that uses it cuts the time to reach the data. The everyday example is a web browser keeping a cached copy of a page it has already fetched, which removes the latency of going back to the server. The same idea scales up: a content delivery network is nothing but replication for performance.

2. Increased availability. Users want a service to be available whenever they need it, and replication gives redundancy, so the data is still reachable when a server fails. The arithmetic is worth quoting, because it shows how fast availability improves:

availability=1pn

where each of the n servers has an independent probability p of being down. A 5 percent chance of failure gives 95 percent availability with one server, but 10.052=99.75 percent with two independent servers. The word independent is doing the work: two servers in the same rack on the same power supply do not multiply like that.

3. Fault tolerance. Even when one server fails, the data on the others is still served to the users, so a server crash does not bring the whole system down until it can be rebooted. Availability is about reaching some answer; fault tolerance is about reaching a correct one, even while a replica is misbehaving.

Lecture note figure: three ways of replicating a file, explicit replication where the client writes to each server itself, lazy replication where one server copies to the others later, and group replication where the write is multicast to the whole group at once
Three ways to make the copies. Explicit, lazy and group. The difference is who does the copying and when. From the Chapter 7 lecture notes
  • Explicit file replication: the programmer controls the entire process, writing to each server in turn. Maximum control, maximum work, and no transparency at all.
  • Lazy replication: one copy is created on some server, and that server later makes replicas on the others automatically, without the programmer's knowledge. Cheap and fast, and the copies are briefly out of date.
  • Group communication: every write is transmitted to all the servers at once, so the extra copies are made at the same moment as the original. Consistent, and it costs a multicast per write.

The problem replication creates, and it is the only one: inconsistency. If one copy is modified it no longer matches the rest, so to stay consistent every copy must be modified. Everything else in this chapter is a scheme for doing that at an acceptable cost.

Challenges and requirements, for the questions phrased that way:

  • Replication transparency: the client must not know how many copies exist, or which one answered.
  • Consistency: the copies must satisfy the consistency model the application needs, which is a choice, not a given.
  • Update propagation: deciding what to send, the new value or the operation, and when, eagerly or lazily.
  • Cost: storage, and network traffic proportional to the number of replicas.
  • Placement: where to put the replicas so they are near the clients and independent in their failures.
Asked on the paper, word for word
  • What are the benefits and drawbacks of Replication in DS? How do Gossip Architecture avoid issues of active and passive replication? Explain. 2081 Bhadra Q6 · 3+5
  • What is the requirement for replications? Compare passive and active replication architectures with necessary figures and steps. 2080 Bhadra Q7 · 2+3+3
  • List the challenges of replication in DS. Explain how passive replication model supports in fault tolerance. How it is differ than active replication model? 2079 Bhadra Q6 · 3+4+2
  • Mention the requirements and challenges of replication. Explain active replication model in fault tolerance. How it is differ than passive model? 2078 Bhadra Q7 · 2+4+2
  • Define replication and fault tolerance in DS and explain why are they necessary? Explain how replication enhanced scalability for DS. 2073 Shrawan Q7 · 6+2
  • What are the reasons for Replication? Explain active replication model with its advantages and disadvantages. 2072 Chaitra Q7 · 3+5
  • What are the reasons for replicating the service provide? Discuss about fault tolerant services. 2072 Kartik Q7 · 4+4
  • What are the major objectives for replication in distributed system? Explain primary backup model for fault tolerance. 2070 Chaitra Q8 · 3+5

7.2The system model

Front ends, replica managers and the five phases

Every replication scheme in this chapter is a different filling of the same frame, so learn the frame once.

Lecture slide: the replication system model, clients talking to front ends, and the front ends talking to a service made of several replica managers that hold the replicas
The frame. A client never speaks to a replica. It speaks to a front end, which is what makes replication transparent. From the Chapter 7 replication lecture slides
  • Replica manager (RM): a component that holds a replica of the object and performs operations on it directly. The set of replica managers is the service.
  • Front end (FE): the component the client actually calls. It hides the replication: it decides which replica managers to contact, collects the replies and returns one answer. A front end may be a library linked into the client, or a separate process.

The five phases every request passes through, which is the list an eight mark answer needs:

  1. Request: the front end sends the request to one or more replica managers, either to one that forwards it, or by multicast to all of them.
  2. Coordination: the replica managers agree whether to apply the request and in what order relative to other requests. This is where the multicast ordering of chapter 6 is used: FIFO, causal or total ordering, depending on what the application needs.
  3. Execution: the replica managers execute the request, perhaps tentatively so that it can be undone.
  4. Agreement: they reach consensus on the effect of the request, for example by committing it.
  5. Response: one or more replica managers reply to the front end, which returns a single answer to the client.

Why phases 2 and 4 are separate is the subtle point: coordination decides the order before anything runs, agreement decides whether the effect stands after it has run. Active replication does all its work in phase 2; passive replication does it in phase 4.

7.3Object replication

Replicating objects, and handling concurrent invocations PIN 1/22

70 Asa2+4

The definition. Data in a distributed system is a collection of items called objects, where an object may be a file or an object created by the programming language. Object replication is the mechanism of forming physical replicas of such objects, each stored at a single computer and tied to some degree of consistency.

The problem an object adds that a plain data item does not: an object has methods, so two clients may invoke operations on it at the same time. If the object is shared, those concurrent accesses must be managed to guarantee that the state stays consistent.

Lecture note figure: data replication with users A, B and C reaching one shared object, and below it the same object replicated into several copies inside a boundary, so each user reaches a different physical replica
One object, then many. Above, three users share one object and the object itself serialises them. Below, the object has been replicated, and now something has to serialise the replicas. From the Chapter 7 lecture notes

Where the concurrency can be handled, which is what the question "how to handle concurrent invocations with object replication" wants:

  • In the object itself. The object provides its own locking or synchronisation, as a Java synchronized method does. Simple, and it only protects one replica.
  • In the middleware. The object adapter or the ORB serialises the invocations before they reach the object, so every replica applies them in the same order. This is the distributed answer, and it is exactly the coordination phase of the system model.
  • By totally ordered multicast, which is how active replication does it: every replica receives the same requests in the same order, so identical deterministic objects reach identical states without any locking at all.
  • By a primary, which is how passive replication does it: only one replica executes, so concurrency is handled in one place and the others are simply told the result.
Asked on the paper, word for word
  • How do you say that replication is one of the scaling techniques in Distributed System? How to handle concurrent invocations with object replication in distributed object based system? 2070 Ashad Q7 · 2+4

7.4Replication as a scaling technique

Why replication is the standard answer to scale PIN 3/22

75 Ch · 73 Shr · 70 Asa2+42+66+2

Chapter 1 listed three ways to scale: hide communication latency, distribute the work, and replicate. This card is the third one, and papers ask it as "how is replication used as a basic scaling technique".

  • It removes the single server bottleneck. With n replicas the read load is divided by n, so a service that could serve a thousand clients now serves many thousands without any machine working harder.
  • It shortens the distance. A replica placed near a group of clients turns a wide area request into a local one, which is the only way to beat geographical scalability limits, since the speed of light does not negotiate.
  • Caching is replication. A cache at a browser, a proxy or a content delivery network is a replica with a short life, and it is what actually makes the web survive its load.
  • It removes the single point of failure, so the system can also grow in administrative scale, because no one machine has to be trusted or maintained perfectly.

And the catch, which must be in the answer. Replication improves reads and makes writes worse: every update must reach every replica, so write traffic grows with the number of copies, and keeping them consistent costs coordination messages. The standard engineering answer is to weaken the consistency rather than the replication, which is why the consistency models in 7.7 exist and why gossip in 7.8 is the scalable choice.

Asked on the paper, word for word
  • How replication is used as a basic scaling technique in distributed system? Explain the active replication model with its advantages and disadvantages. 2075 Chaitra Q7 · 2+6
  • Define replication and fault tolerance in DS and explain why are they necessary? Explain how replication enhanced scalability for DS. 2073 Shrawan Q7 · 6+2
  • How do you say that replication is one of the scaling techniques in Distributed System? How to handle concurrent invocations with object replication in distributed object based system? 2070 Ashad Q7 · 2+4

7.5Active replication

Every replica does the work TOP 10/22

81 Ba · 80 Bh · 79 Bh · 78 Bh · 76 Ch · 75 Ch · 75 Ash · 74 Ash · 72 Ch · 69 Ch3+52+4+22+3+3

Active replication Every replica sees exactly the same set of messages in the same order and processes them in that order. It assumes the objects are deterministic and requires a group communication mechanism that delivers the same messages to every replica in the same order.
Lecture slide: the active model, front ends multicasting each request to a group of three replica managers, each of which processes it independently and replies
No primary. Front ends multicast to the whole group; every replica manager is a state machine playing an equivalent role, and each one replies. From the Chapter 7 replication lecture slides

The five phases, filled in for active replication:

  1. Request: the front end attaches a unique identifier and totally ordered reliable multicasts the request to the group of replica managers.
  2. Coordination: the group communication system delivers the request to every replica manager in the same total order. This phase is where all the work happens.
  3. Execution: every replica manager executes the request. Because they are deterministic state machines starting from the same state and receiving the same ordered input, they all reach the same new state.
  4. Agreement: no agreement phase is needed, because the total ordering already guaranteed it.
  5. Response: each replica manager sends its response to the front end, which takes the first, or compares them if it wants to tolerate wrong answers.

Benefits:

  • Every server can respond to client queries with up to date data, so reads scale with the number of replicas.
  • Immediate failover: a replica dying is invisible, because the others already have the answer and the front end simply uses one of theirs. There is no recovery pause.
  • It can tolerate Byzantine failures, because the front end can collect several responses and take the majority, which passive replication cannot do.

Limitations:

  • Waste of resources, since all replicas do exactly the same work, so n machines deliver the throughput of one for writes.
  • It propagates updates only, which requires determinism. Any operation whose result depends on the local clock, a random number or the order of local threads will make the replicas diverge.
  • It depends on totally ordered multicast, which is expensive and is itself a consensus problem.
Asked on the paper, word for word
  • Write short notes on: Active replication technique in DS 2081 Baishakh Q8c · 5
  • What is the requirement for replications? Compare passive and active replication architectures with necessary figures and steps. 2080 Bhadra Q7 · 2+3+3
  • List the challenges of replication in DS. Explain how passive replication model supports in fault tolerance. How it is differ than active replication model? 2079 Bhadra Q6 · 3+4+2
  • Mention the requirements and challenges of replication. Explain active replication model in fault tolerance. How it is differ than passive model? 2078 Bhadra Q7 · 2+4+2
  • What is fault? How to implement primary-backup replica system? How is it differ from active replication? 2076 Chaitra Q6 · 2+4+2
  • How replication is used as a basic scaling technique in distributed system? Explain the active replication model with its advantages and disadvantages. 2075 Chaitra Q7 · 2+6
  • Differentiate between passive and active replication approach. Discuss with a technique that make the distributed system highly available. 2075 Ashwin Q8 · 3+5
  • Differentiate between active and passive replication. Explain working mechanism of active replication. 2074 Ashwin Q7 · 3+5
  • What are the reasons for Replication? Explain active replication model with its advantages and disadvantages. 2072 Chaitra Q7 · 3+5
  • Compare passive replication with active replication approach. Also discuss with a technique that make the distributed system service highly available. 2069 Chaitra Q7 · 2+4

7.6Passive replication

One primary does the work and tells the others TOP 10/22

81 Ba · 80 Bh · 80 Ba · 79 Bh · 78 Bh · 76 Ch · 75 Ash · 74 Ash · 70 Ch · 69 Ch3+52+4+22+3+3

Passive replication, the primary backup model One server plays a special primary role: it performs all the updates, maintains the most up to date state, and propagates the updates to the backup replicas eagerly or lazily. The backups may serve read requests.
Lecture slide: the passive model, two clients each with a front end, both communicating with one primary replica manager which updates the two backup replica managers
One primary, two backups. Every front end talks to the primary; the primary alone talks to the backups. From the Chapter 7 replication lecture slides
Lecture note figure: the primary backup protocol in six numbered steps, the client requesting, the primary doing the work and updating the backup, the backup acknowledging and the primary replying to the client
The six steps. Request, do work, update, do work at the backup, acknowledge, reply. The numbers matter, because the failure analysis below is written against them. From the Chapter 7 lecture notes

The five phases, filled in for passive replication:

  1. Request: the front end sends the request, carrying a unique identifier, to the primary replica manager only.
  2. Coordination: the primary takes each request in the order it arrives, and checks the identifier in case it has already executed this request; if so it simply resends the old reply.
  3. Execution: the primary executes the request and stores the response.
  4. Agreement: if the request is an update, the primary sends the updated state, the response and the identifier to all the backups, and each backup acknowledges. This phase is where all the work happens.
  5. Response: the primary responds to the front end, which hands the result to the client.

What happens when the primary crashes, analysed against the six steps of the figure, which is worth a mark or two on its own:

  • Before step 2, before doing the work: no harm is done, and the backup simply redoes it.
  • After the work but before the update: the work is done a second time by the backup.
  • After step 4 and before step 6: the work may end up being done three times, once by the primary, once by the backup as a result of the update, and once after the backup becomes the primary.

Recovery from a primary failure may therefore be time consuming and complex, and the correct answer is that operations should be idempotent or identified so duplicates can be filtered, which is what the request identifier in phase 2 is for.

Three kinds of failover, a neat three point list:

  • Cold failover: the backup restarts the applications that were running on the primary. Any work in progress is lost.
  • Warm failover: applications periodically write checkpoint files to storage shared with the backup; the backup reads them and resumes from the last checkpoint.
  • Hot failover: the backup runs in lockstep with the primary on the same inputs, so when it takes over it is already in the exact state the primary was in.

Choosing the new primary is an election, and the surviving replica managers must also agree on the set of operations the old primary had completed, which is why view synchronous group communication is used.

PointActive replicationPassive replication
Who executesEvery replica managerOnly the primary
Communication neededTotally ordered reliable multicastOrdinary RPC, plus a view synchronous update
DeterminismRequiredNot required
Network traffic when healthyHigher: every request goes to every replicaLower: one request, then one update
Failure of a replicaInvisible, immediate failoverA backup dying is harmless; the primary dying costs an election and a pause
Byzantine failuresTolerated by comparing responsesNot tolerated: a lying primary is believed
ComplexityHarder, because of the ordered multicastEasier, and typically simpler to implement
RecoveryNothing to recoverLonger recovery, with possible data loss
Lecture note figure: passive replication with clients reaching one primary that updates the backups, beside active replication where every client request reaches every member of the replica group
The two in one picture. On the left the clients all funnel through one primary; on the right every client reaches every member of the group. From the Chapter 7 lecture notes
Asked on the paper, word for word
  • How do you elect replica manager in primary backup replication? Explain. 2081 Baishakh Q5 · 10
  • What is the requirement for replications? Compare passive and active replication architectures with necessary figures and steps. 2080 Bhadra Q7 · 2+3+3
  • What are the different consistency models applicable in a distributed system? How does a primary-backup model work? 2080 Baishakh Q6 · 5+5
  • List the challenges of replication in DS. Explain how passive replication model supports in fault tolerance. How it is differ than active replication model? 2079 Bhadra Q6 · 3+4+2
  • Mention the requirements and challenges of replication. Explain active replication model in fault tolerance. How it is differ than passive model? 2078 Bhadra Q7 · 2+4+2
  • What is fault? How to implement primary-backup replica system? How is it differ from active replication? 2076 Chaitra Q6 · 2+4+2
  • Differentiate between passive and active replication approach. Discuss with a technique that make the distributed system highly available. 2075 Ashwin Q8 · 3+5
  • Differentiate between active and passive replication. Explain working mechanism of active replication. 2074 Ashwin Q7 · 3+5
  • What are the major objectives for replication in distributed system? Explain primary backup model for fault tolerance. 2070 Chaitra Q8 · 3+5
  • Compare passive replication with active replication approach. Also discuss with a technique that make the distributed system service highly available. 2069 Chaitra Q7 · 2+4

7.7Fault tolerant services and consistency models

What a fault tolerant service is, and how consistent it must be PIN 3/22

80 Ba · 76 Ash · 72 Ka4+45+58

Start with the definition: a system is said to have failed when it does not meet its specification. Replication is the standard way of preventing that.

The classes of fault, a reliable three or four mark list:

  • Transient faults occur once and then disappear. A bird flying through a microwave beam loses some bits on the network; a retry works.
  • Intermittent faults occur, vanish, reappear, and so on. A loose connector is the standard example, and it is the hardest kind to diagnose.
  • Permanent faults continue until repaired: a burnt out chip, a software bug, a disk head crash.
  • System failures come in two processor kinds: fail silent, where the faulty processor simply stops and does not respond, and Byzantine, where it continues to run but gives wrong answers.

Three kinds of redundancy, which is how fault tolerance is actually bought:

  • Information redundancy: extra bits, so a garbled value can be recovered. Error correcting codes.
  • Time redundancy: do it again. Cheap, and useless against a permanent fault.
  • Physical redundancy: add extra components, either active replication, using them all at once, or primary backup, using the spare when one fails.

The three issues for physical redundancy: the degree of replication required; the average and worst case performance in the absence of faults; and the average and worst case performance when a fault occurs.

Triple modular redundancy

Lecture note figure: triple modular redundancy, three copies of each stage A, B and C, with a voter after each stage that takes three inputs and outputs the value that at least two of them agree on
TMR. Each stage is tripled and each is followed by three voters. A single failure anywhere is masked before it reaches the next stage. From the Chapter 7 lecture notes

How it works. Each device is replicated three times, and each stage is followed by a triplicated voter. A voter is a circuit with three inputs and one output: if two or three of the inputs are the same, the output is equal to that input; if all three differ, the output is undefined.

The worked case from your notes. Suppose element A2 fails. Each of the voters V1, V2 and V3 receives two good inputs and one rogue one, and each outputs the correct value to the second stage, so the inputs to B1, B2 and B3 are exactly what they would have been with no fault. The failure is completely masked. If B3 and C1 also fail, those are masked too, and the three final outputs are still correct. Everyday analogues: a 747 has four engines and flies with three; a match has several referees in case one misses an event.

k fault tolerance, the replication bound A system is k fault tolerant if it can survive faults in k components and still meet its specification. It needs k+1 processors for k fail-stop faults, since one correct machine is left, and 2k+1 for k Byzantine faults, since k may send wrong replies but k+1 still give the correct one, so a majority vote wins.

Consistency models

A consistency model is the contract between the processes and the data store. Ideally a read returns the value of the last write, but with no global clock "last" is not well defined, so a model states exactly what is promised.

Lecture note tables: the consistency models that use no synchronisation operations, strict, sequential, causal, processor and PRAM, each with a one line description, and below them the models that do use synchronisation, weak, release and entry
The two tables. Above, the models that need no synchronisation operations; below, the ones that do. Learn them in order, each weaker than the one above. From the Chapter 7 lecture notes
  • Strict consistency: the strongest. A write by any processor must be seen instantaneously by all processors, as if a global clock existed. Unimplementable in a real distributed system.
  • Sequential consistency: weaker. A write need not be seen instantly, but writes by different processors must be seen in the same order by all processors. Lamport's definition: the result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each processor appear in that sequence in the order its program specified.
  • Causal consistency: weakens sequential consistency by separating events that are causally related from those that are not. Only causally related writes must be seen in the same order by all processes.
  • Processor consistency: processors must agree on the order of writes made by one processor, and on writes by different processors to the same location, which is coherence. They need not agree about writes by different processors to different locations.
  • Release consistency: distinguishes the entry to a critical section, acquire, from the exit, release. On acquire all operations on local memory variables must be complete; on release all changes made locally must be propagated to the other processors.
  • Entry consistency: a variant of release consistency in which every shared variable has its own synchronisation variable, so an acquire on x requires only the operations on x to complete. This lets different critical sections on different variables run concurrently.

The pattern to notice: each model down the list demands less, and each therefore costs less. Choosing one is an engineering decision about how much staleness the application can tolerate.

Asked on the paper, word for word
  • What are the different consistency models applicable in a distributed system? How does a primary-backup model work? 2080 Baishakh Q6 · 5+5
  • Specify Data Centric consistency models and explain any one of them in detail. 2076 Ashwin Q7 · 8
  • What are the reasons for replicating the service provide? Discuss about fault tolerant services. 2072 Kartik Q7 · 4+4

7.8Highly available services

Gossip: the technique that makes a service highly available HOT 4/22

81 Bh · 75 Ash · 71 Shr · 69 Ch3+52+4

The difference from fault tolerance, and it is the first sentence of the answer. A fault tolerant service keeps giving correct answers, which needs the replicas to agree before replying, so a client waits. A highly available service gives an answer whenever the client asks, using whatever replicas are reachable, and accepts that the answer may be slightly stale. Availability is bought with consistency.

Lecture slide: the gossip architecture, clients sending queries and updates to front ends that carry vector timestamps, and replica managers exchanging gossip messages among themselves to spread updates lazily
The gossip architecture. Clients reach a front end, front ends reach any replica manager, and the replica managers exchange gossip among themselves in the background. From the Chapter 7 replication lecture slides
Gossip architecture A framework for highly available services in which a front end sends a query or an update to any available replica manager, and the replica managers exchange gossip messages lazily among themselves to bring each other up to date.

The two guarantees it makes:

  • Each client obtains a consistent service over time, meaning it never sees data older than what it has already seen, even if it moves to a different replica manager.
  • Relaxed consistency between replicas. All replica managers eventually receive all updates and apply them in an order that respects causality. This is eventual consistency.

How the vector timestamps do it. Each front end keeps a vector timestamp prev reflecting the latest data it has seen, and every request carries it. A replica manager that has not yet received those updates holds the request back until gossip brings them, so the client can never go backwards in time. When clients communicate directly with each other they piggyback their vector timestamps, which are then merged, so causality is preserved even outside the service.

How a request is processed:

  1. Request: the front end sends the request to a replica manager, normally the nearest or least loaded one. A query blocks; an update returns at once.
  2. Update response: the replica manager replies to an update immediately, before it has been applied anywhere else, which is why the service feels fast.
  3. Coordination: the replica manager holds the request until it can be applied in causal order, gossiping if necessary to collect the missing updates.
  4. Execution: it executes the request against its own replica.
  5. Query response: it replies to a query, with the new vector timestamp.
  6. Agreement: the replica managers propagate the update lazily, by exchanging gossip messages whenever convenient. This is the phase that is deliberately delayed.

What a replica manager holds: the value, which is the application state; a value timestamp; an update log of updates not yet stable; a replica timestamp recording the updates accepted; and an executed operation table, which stops an update being applied twice when it arrives again by gossip.

How gossip answers active and passive replication, which is the phrasing 2081 Bhadra uses. Active replication makes every client wait for a totally ordered multicast, and passive replication makes every client wait for the one primary, so both are unavailable exactly when the network is partitioned. Gossip takes the update at any replica and returns immediately, so a partitioned or distant client still gets service; the cost is that other clients may not see the update for a while, which the vector timestamps keep from being incoherent.

Two case studies worth naming: Bayou, which lets any replica accept updates and resolves conflicts later by application supplied merge procedures, and Coda, a file system that lets a disconnected laptop keep working on cached files and reintegrates on reconnection.

Asked on the paper, word for word
  • What are the benefits and drawbacks of Replication in DS? How do Gossip Architecture avoid issues of active and passive replication? Explain. 2081 Bhadra Q6 · 3+5
  • Differentiate between passive and active replication approach. Discuss with a technique that make the distributed system highly available. 2075 Ashwin Q8 · 3+5
  • How to come to consensus in DS? Discuss with an approach, how do you make the distributed system service highly available? 2071 Shrawan Q6 · 3+5
  • Compare passive replication with active replication approach. Also discuss with a technique that make the distributed system service highly available. 2069 Chaitra Q7 · 2+4

7.9Transactions with replicated data

Keeping ACID when there are many copies

A transaction on replicated data must behave as if there were only one copy, and that requirement has a name.

One copy serializability The effect of transactions performed by clients on replicated objects should be the same as if they had been performed one at a time on a single set of objects.

Read one, write all, the simplest scheme: a read is performed at any single replica manager, and a write must be performed at every replica manager. It gives one copy serializability directly, and it stops working the moment any replica manager is unavailable.

Available copies replication relaxes it: a read goes to any available replica manager, and a write goes to all the available ones. Failures and recoveries are handled by a local validation step: before a transaction commits, it checks that no replica manager it read from has failed since, and that no replica manager it wrote to has recovered since, because either event would break the one copy illusion.

Network partitions are the hard case, because two halves may each think the other has failed and both accept writes. Two standard answers:

  • Quorum consensus: give every replica a number of votes, and require a read quorum R and a write quorum W such that W>N/2 and R+W>N. The overlap guarantees that any read sees at least one copy of the latest write, and the majority rule means only one partition can write.
  • Virtual partition, which combines quorum consensus with available copies: a transaction may proceed only inside a virtual partition that holds enough replicas to form both quorums.

7.10Last minute recall

Chapter 7 in one screen

  • Three reasons: performance, increased availability (1pn), fault tolerance.
  • Three ways to replicate: explicit, lazy, group communication.
  • The one problem: inconsistency.
  • System model: client, front end, replica managers. Five phases: request, coordination, execution, agreement, response.
  • Active: totally ordered multicast, every replica executes, needs determinism, immediate failover, tolerates Byzantine faults, wastes resources.
  • Passive: one primary executes and updates backups, needs no determinism, less traffic, needs an election and a slower recovery, cannot tolerate a lying primary.
  • Failover: cold (restart), warm (checkpoints), hot (lockstep).
  • Faults: transient, intermittent, permanent. Processor: fail silent or Byzantine.
  • Redundancy: information, time, physical. TMR masks one fault per stage with three voters.
  • k fault tolerant: k+1 processors for fail-stop, 2k+1 for Byzantine.
  • Consistency, strongest first: strict, sequential, causal, processor, PRAM; then weak, release, entry.
  • Gossip: any replica manager answers, updates spread lazily, vector timestamps keep each client consistent over time. Eventual consistency.
  • Transactions: one copy serializability; read one write all; available copies with local validation; quorums with W>N/2 and R+W>N.

Chapter 8 · 6 hours · about 9 marks a paper · in 19 of 22 sittings

Transaction and concurrency control

A transaction is a promise: all of it happens, or none of it does, and while it runs nobody else can see it half finished. This chapter keeps that promise on one server with locks, timestamps or optimistic validation, and then across several servers with the two and three phase commit protocols. It is the longest chapter in the syllabus and usually two questions on the paper.

What this chapter is about
  • Transactions: what they promise (ACID), the operations, and the two problems concurrency creates.
  • Nested transactions and their commit rules.
  • Three concurrency control methods: locking, optimistic validation and timestamp ordering, and how to choose.
  • Distributed transactions: flat and nested, and the atomic commit protocols 1PC, 2PC and 3PC.
  • Distributed deadlock: detection, prevention and the phantom deadlock.
Where it fits
  • Atomic commit is consensus from chapter 6, which is why it inherits the blocking problem.
  • Timestamp ordering uses the logical clocks of chapter 5.
  • The transaction and concurrency services of CORBA are these protocols offered as middleware.
  • Recovery of a transaction is chapter 9's logging and checkpointing.
What you will learn
  1. 8.1 Transactions, ACID and the concurrency problems
  2. 8.2 Nested transactions
  3. 8.3 Locks and two phase locking
  4. 8.4 Problems with locking
  5. 8.5 Optimistic concurrency control
  6. 8.6 Timestamp ordering
  7. 8.7 Comparison of the three methods
  8. 8.8 Distributed transactions, flat and nested
  9. 8.9 Atomic commit protocols: 1PC and 2PC
  10. 8.10 Three phase commit
  11. 8.11 Concurrency control in distributed transactions
  12. 8.12 Distributed deadlocks
  13. 8.13 Last minute recall, chapter 8
How it is examined
  • Two questions in most papers: one on concurrency control and one on the commit protocols.
  • The three repeats: "flat and nested transactions" then a protocol; "compare nested and distributed transaction" then 2PC; "cascading aborts" then 3PC.
  • Draw the state machines for 2PC and 3PC. They are asked with the words "with state diagram" in three sittings.

8.1Transactions

What a transaction promises, and what goes wrong without it PIN 1/22

76 Ash8

Transaction A sequence of requests to a server by a client that keeps all the objects in a consistent state, performed as an indivisible unit by the servers that manage those objects. Equivalently, a sequence of operations that performs a single logical function.

Everyday examples, and each one shows why indivisibility matters: withdrawing money from an account, making an airline reservation, making a credit card purchase, registering for a course. A cash machine hands you the notes and deducts the amount; doing one without the other is a disaster in either direction.

Why a transaction must be atomic, which is three claims:

  • It must be free from interference by the operations of other clients.
  • Either all its operations complete successfully, or they must have no effect at all in the event of a server crash.
  • It is created and managed by a coordinator, which implements the coordinator interface.

Two terms behind the definition: recoverable objects are objects that can be recovered after their server crashes, and atomic operations are operations free from interference by concurrent operations in other threads. A transaction applies to recoverable objects and is intended to be atomic.

ACID Atomicity: the transaction is all or none. Consistency: it takes the system from one consistent state to another. Isolation: one transaction cannot interfere with another. Durability: the effects of a committed transaction survive a crash, because its log is stored in non volatile storage.

The operations, with their method names, which papers do ask for:

  • Begin transaction: openTransaction() returns a unique transaction identifier and marks the start.
  • End transaction: closeTransaction(trans) returns commit if the transaction committed, or abort if it did not.
  • Abort transaction: abortTransaction(trans) terminates it and restores the old values.
  • Read and Write, performed on behalf of the transaction.

The two problems of concurrent transactions

Both of these are standard examples and both are worth drawing as a two column table of operations in time order.

1. The lost update problem. Balances are A 100, B 200, C 300. Transactions T and U both add 10 percent of B's balance to B and withdraw the same amount elsewhere:

Transaction TTransaction U
balance = b.getBalance() reads 200
balance = b.getBalance() reads 200
b.setBalance(balance*1.1) writes 220
b.setBalance(balance*1.1) writes 220
a.withdraw(balance/10) A becomes 80
c.withdraw(balance/10) C becomes 280

B should have ended at 242, since two separate 10 percent increases were applied. It ended at 220, because U read the old value before T wrote the new one. One update was lost.

2. The inconsistent retrieval problem. A and B both hold 200. T moves 100 from A to B while U totals the branch:

Transaction TTransaction U
a.withdraw(100) A becomes 100
total = a.getBalance() gets 100
total = total + b.getBalance() gets 300
b.deposit(100) B becomes 300

U reports 300 when the branch actually holds 400. Nothing was lost, but U saw the system halfway through T, which isolation is supposed to prevent.

The cure for both is serial equivalence. An interleaving of two transactions is serially equivalent if its effect is the same as executing them one after the other in some order. That is the correctness criterion every method in this chapter is trying to enforce.

Lecture slide: three simple transactions on the same variable and three possible schedules of their operations, two marked legal because they are serially equivalent and one marked illegal
Legal and illegal schedules. Three transactions on one variable. Schedules 1 and 2 are equivalent to some serial order; schedule 3 is not, so it is illegal. From the Tanenbaum figure deck
Asked on the paper, word for word
  • Why is it necessary to maintain transaction? What is a deadlock and what are phantom deadlocks. 2076 Ashwin Q8 · 8

8.2Nested transactions

Transactions inside transactions, and the five commit rules HOT 7/22

79 Bh · 78 Bh · 72 Ch · 72 Ka · 71 Ch · 71 Shr · 69 Ch2+4+22+63+4

Nested transaction A transaction composed of other transactions. The outermost is the top level transaction and the others are sub-transactions. Sub-transactions at the same level may run concurrently, but their access to common objects is serialised.

Why anyone wants them, with the standard example: planning a trip involving three flights. Each flight's reservation commits individually, so the work is not lost if the fourth step is slow, but the whole set must be undone if the entire trip cannot be arranged. Nesting also gives concurrency within one transaction and partial failure: one leg can fail and be retried without abandoning the others.

The five rules for commit, which is the answer to "relationship between parent and child transactions":

  1. A transaction may commit or abort only after its child transactions have completed.
  2. When a sub-transaction completes, it makes an independent decision either to commit provisionally or to abort. Provisional means the decision can still be reversed by an ancestor.
  3. When a parent aborts, all of its sub-transactions are aborted, however they voted.
  4. When a sub-transaction aborts, the parent can decide whether to abort or not, so one failed leg need not kill the trip.
  5. If the top level commits, all the sub-transactions that have provisionally committed can commit, provided none of their ancestors has aborted.

Rule 2 is why nested transactions need a commit protocol of their own, and rule 5 is why the top level commit is what finally makes anything permanent. Compare this with distributed transactions, which nest across servers rather than inside one.

Asked on the paper, word for word
  • Define flat and nested transactions. Discuss the approach of optimistic concurrency control in distributed transactions. 2079 Bhadra Q7 · 4+4
  • What are the Flat and Nested Transactions? Explain how the problems of 2PC protocols are solved by 3PC. 2078 Bhadra Q9 · 2+6
  • What do you mean by nested transactions? Explain optimistic concurrency control method with its advantages over other concurrency control methods. 2072 Chaitra Q8 · 2+4+2
  • Define flat and nested transaction. Discuss the approach of optimistic concurrency control in distributed transactions. 2072 Kartik Q5 · 4+6
  • Write short notes on: Flat versus nested locks 2071 Chaitra Q9c · 4
  • What are the relationships between parent and child transactions in DS? Write the problems of locking with the solutions to avoid it. 2071 Shrawan Q7 · 4+8
  • What are the flat and nested transactions? Describe the methods for concurrency control in distributed system. 2069 Chaitra Q9 · 3+4

8.3Locks

Two phase locking, and why the second phase matters HOT 4/22

81 Bh · 80 Ba · 73 Shr · 71 Ch1+4+32+63+5

The mechanism. The server attempts to lock any object that a client's transaction is about to use. Requests to lock an object that is already locked are suspended and wait until it is unlocked. A single exclusive lock would let only one transaction near the object at all, so two kinds are used: a read lock, which is shared, and a write lock, which is exclusive.

Lecture note table: the lock compatibility rules for one object, showing that a read request is granted when no lock or a read lock is set and waits under a write lock, and that a write request waits under either kind of lock
The compatibility table. Reads share with reads; anything involving a write waits. This is the whole of "operation conflict rules" in one picture. From the Chapter 8 lecture notes

The operation conflict rules, in words:

  • A request for a write lock is delayed by the presence of a read lock belonging to another transaction.
  • A request for either a read or a write lock is delayed by the presence of a write lock belonging to another transaction.
Serial equivalence through locking Serial equivalence requires that all of a transaction's accesses to a particular object be serialised with respect to the accesses of other transactions. To achieve it, a transaction is not allowed any new locks after it has released a lock.

That single sentence is two phase locking. It splits the life of a transaction into a growing phase, in which new locks are acquired, and a shrinking phase, in which locks are released, with the changeover at the lock point.

Lecture note graph: the number of locks held by a transaction rising in steps through the growing phase to the lock point, then falling in steps through the shrinking phase
Why it is called two phase. The count of locks held rises, reaches the lock point, and then only falls. Any lock acquired after a release would break serial equivalence. From the Chapter 8 lecture notes

Two stronger variants, and the difference between them is examined:

  • Strict execution, or strict two phase locking: locks are held until the transaction commits or aborts, so the shrinking phase happens all at once at the end. This prevents another transaction reading or overwriting an uncommitted value, which is what stops cascading aborts.
  • Recoverability: locks must be held until all the objects the transaction updated have been written to permanent storage.
Lecture slide: strict two phase locking, in which all the locks a transaction holds are released together at the moment it commits rather than gradually
Strict 2PL. Every lock is released at the same instant, the commit, instead of gradually. From the Tanenbaum figure deck

The four rules for using a lock, which is the procedural answer:

  1. If the object is not already locked, it is locked and the operation proceeds.
  2. If the object has a conflicting lock set by another transaction, the transaction must wait until it is unlocked.
  3. If the object has a non conflicting lock set by another transaction, the lock is shared and the operation proceeds.
  4. If the object has already been locked in the same transaction, the lock is promoted if necessary and the operation proceeds. Where promotion is prevented by a conflicting lock, rule 2 applies.

When a transaction commits or aborts, the server unlocks every object it locked for that transaction.

Lecture note table: transactions T and U running the same balance update, with the lock on B acquired by T, U waiting for it, and the locks released only when each transaction closes
Locking in action. T locks B, so U must wait for T's lock on B before it can even read. Both release everything at close. From the Chapter 8 lecture notes

Where the lock manager lives, in a distributed system

  • Centralized 2PL: one scheduler for the whole distributed system, and all lock requests are issued to it. Simple, and a bottleneck and single point of failure.
  • Primary copy 2PL: each data item is assigned a primary copy, and the lock manager on that copy is responsible for locking and releasing it. The locking is distributed, but each item still has one home.
  • Distributed 2PL: a scheduler at every site, each handling the lock requests for the data at that site. A transaction may read any replica by obtaining a read lock on one copy, but writing requires a write lock on all the copies.
Asked on the paper, word for word
  • What are the benefits and drawbacks of using locks in distributed transaction processing? Explain the timestamp-based ordering technique for concurrency control in DS. 2081 Bhadra Q7 · 3+5
  • Briefly explain different methods for concurrency control. What are the drawbacks of 2PL and how does strict 2PL overcomes those? 2080 Baishakh Q7 · 2+6
  • What is LOCK and DEADLOCK in DS? Discuss the methods of distributed deadlock avoidance. 2073 Shrawan Q8 · 4+6
  • Define lock in concurrency control. How can concurrency be controlled in distributed transactions? What situation does lead to distributed deadlock? 2071 Chaitra Q8 · 1+4+3
  • Write short notes on: Flat versus nested locks 2071 Chaitra Q9c · 4

8.4Problems with locking

The four drawbacks, and cascading aborts HOT 4/22

75 Ash · 74 Ash · 72 Ka · 71 Shr82+64+8

The drawbacks, a reliable three or four mark list:

  • Overhead. Lock maintenance is a cost that a system without concurrent access does not pay at all, and it is paid on every operation, not only the conflicting ones.
  • Deadlock. The use of locks can lead to deadlock, and the usual answers are unsatisfying: prevention by locking everything at the start destroys concurrency, and detection or timeout is awkward in an interactive program.
  • Reduced concurrency. A locked object cannot be used by anybody else until it is unlocked, and to avoid cascading aborts the locks cannot be released until the end of the transaction, which shrinks concurrency further.
  • Starvation is possible, since a transaction may keep waiting while others acquire and release the lock.
Cascading abort A transaction reads a value written by another transaction that has not yet committed, and that other transaction then aborts. The reader has used a value that never existed, so it must abort too, and anything that read its output must abort in turn, cascading through the system.

How cascading aborts occur and how they are solved, which is a full four mark part in two sittings. They occur because of dirty reads: a transaction was allowed to see uncommitted data. Three solutions, in order of how completely they fix it:

  • Strict two phase locking, the standard answer: hold every lock until commit or abort, so no uncommitted value is ever visible and a cascade cannot start.
  • Tentative versions: a transaction writes to its own private copies, which are applied to the real object only at commit. This is what optimistic concurrency control and timestamp ordering both do.
  • Commit dependency: allow the read, but record that the reader cannot commit before the writer does, and abort it if the writer aborts. This preserves concurrency and adds bookkeeping.

Two variants that recover some of the lost concurrency:

  • Two version locking lets a write proceed while other transactions are reading the committed version. There are three lock types: read, write and commit. The rules: a transaction may not set a write lock on an object that has an uncommitted write lock or a commit lock, and may not set a read lock on an object with a commit lock; a write lock is converted to a commit lock when the transaction commits, and if any other transaction holds a read lock, the committing transaction waits until they finish. It allows more concurrency than ordinary read and write locks, at the cost of a delay at commit time.
  • Hierarchic locks, also called locks of mixed granularity: a lock may be set on a whole file or on one record, with intention locks marking the path down the hierarchy. A coarse lock costs less bookkeeping; a fine lock allows more concurrency.
Asked on the paper, word for word
  • Write down the rule of two-version locking. Explain how Optimistic concurrency control mechanism works? 2075 Ashwin Q9 · 2+6
  • How cascading aborts occurs and solved? Explain three phase commit protocol with state diagram. 2074 Ashwin Q8 · 8
  • How cascading aborts occurs and can be solved? Explain the needs and roles of atomic commit protocol in distributed system. 2072 Kartik Q8 · 8
  • What are the relationships between parent and child transactions in DS? Write the problems of locking with the solutions to avoid it. 2071 Shrawan Q7 · 4+8

8.5Optimistic concurrency control

Assume there is no conflict, and check at the end HOT 4/22

79 Bh · 75 Ash · 72 Ch · 72 Ka2+4+22+64+4

The premise. Conflicts are rare in most applications, so locking makes every transaction pay for a problem that usually does not happen. Optimistic concurrency control lets transactions proceed as though there were no possibility of conflict until the client issues closeTransaction. If a conflict did arise, one of the transactions is aborted and must be restarted by the client.

The three phases.

  • Working phase. Each transaction gets a copy of the most recently committed version of the object. Reads are performed immediately. Writes record new values as tentative values, and the same object can have several tentative values, one per active transaction.
  • Validation phase. When closeTransaction is received, the transaction is validated to confirm whether or not conflicts occurred. On successful validation it may commit.
  • Update phase. If the transaction is validated, all its tentative values are made permanent.
Lecture slide: the working, validation and update phases of several transactions on a time line, showing the transaction being validated against earlier committed transactions and later active ones
What validation compares against. The transaction being validated is checked against the earlier committed transactions (backward validation) or against the later active ones (forward validation). From the Chapter 8 transactions lecture slides

How validation works. Each transaction is assigned a transaction number when it enters the validation phase, and a transaction numbered Ti precedes one numbered Tj when i<j. Because numbers are handed out at validation rather than at the start, validation itself is done one transaction at a time in number order.

The three conflict rules. For the transaction being validated, Tv, to be serialisable with respect to an overlapping transaction Ti:

TvTiRule
writereadTi must not read objects written by Tv
readwriteTv must not read objects written by Ti
writewriteTi must not write objects written by Tv, and the reverse
  • Backward validation checks the read set of Tv against the write sets of the transactions that committed since Tv began. If they overlap, Tv is aborted, because only Tv can be sacrificed.
  • Forward validation checks the write set of Tv against the read sets of the transactions still active. If they overlap, there is a choice: abort Tv, defer its validation, or abort the conflicting active transactions.

Advantages over the other methods, which is asked directly:

  • No locking overhead during the working phase, and reads run at full speed.
  • Deadlock is impossible, because nothing ever waits for anything.
  • Maximum concurrency: all transactions are allowed to proceed, and only the losers pay.

And the cost: when conflict is common, work is thrown away repeatedly, and a long transaction can be starved by repeated aborts. The stored tentative versions also cost space.

Asked on the paper, word for word
  • Define flat and nested transactions. Discuss the approach of optimistic concurrency control in distributed transactions. 2079 Bhadra Q7 · 4+4
  • Write down the rule of two-version locking. Explain how Optimistic concurrency control mechanism works? 2075 Ashwin Q9 · 2+6
  • What do you mean by nested transactions? Explain optimistic concurrency control method with its advantages over other concurrency control methods. 2072 Chaitra Q8 · 2+4+2
  • Define flat and nested transaction. Discuss the approach of optimistic concurrency control in distributed transactions. 2072 Kartik Q5 · 4+6

8.6Timestamp ordering

Decide the order first, then enforce it operation by operation PIN 2/22

81 Bh · 70 Ch3+53

The premise. Every transaction is assigned a unique timestamp when it starts, and the serial order is fixed to be timestamp order before anything runs. Each operation is then validated as it is carried out: if it would violate that order the transaction is aborted at once, with no waiting.

The two validity conditions, in words: a request to write an object is valid only if the object was last read and written by earlier transactions; a request to read an object is valid only if it was last written by an earlier transaction.

The write rule for transaction Tc on object D:

if Tcmax(read timestamps on D)andTc>write timestamp on the committed version of D

then perform the write on a tentative version of D with write timestamp Tc; otherwise abort Tc, because it is trying to write under a value a later transaction has already used.

The read rule for transaction Ti:

  • If Ti is greater than the write timestamp on the committed version of D, let Dsel be the version of D with the largest write timestamp not exceeding Ti. If Dsel is committed, perform the read on it; if it is still tentative, wait until that transaction finishes and then reapply the rule.
  • Otherwise abort Ti, because the value it should have read has already been overwritten by a later transaction.

Why tentative versions are kept. Writes go to a tentative version rather than the real object, so an abort costs nothing, a reader can be given the correct older version, and cascading aborts are avoided. This is why the method is also called multiversion timestamp ordering.

Its character: timestamp ordering is pessimistic like locking, since it checks before acting, but unlike locking it never makes a transaction wait for a lock; it aborts. That makes it excellent for read heavy workloads and poor when conflicts are frequent, because the aborts come early and often.

Asked on the paper, word for word
  • What are the benefits and drawbacks of using locks in distributed transaction processing? Explain the timestamp-based ordering technique for concurrency control in DS. 2081 Bhadra Q7 · 3+5
  • Write short notes on: Timestamp ordering in concurrency control 2070 Chaitra Q11b · 3

8.7Comparing the three methods

Which method to use, and why PIN 3/22

80 Ba · 72 Ch · 69 Ch2+4+22+63+4

The six point comparison from your notes, which is the shape of the marks:

  • Timestamp ordering and locking are both pessimistic: they check for conflict before an operation is allowed to take effect.
  • Timestamp ordering is better than locking for read only transactions, because a read never blocks and never has to take a lock.
  • Locking is better when the operations are predominantly updates, because the waits are short and the work is not thrown away.
  • Timestamp ordering aborts a transaction immediately when it detects a conflict.
  • Locking makes the transaction wait instead of aborting it.
  • With optimistic control all transactions are allowed to proceed, and the price is paid only at validation, by whoever loses.
PointLockingTimestamp orderingOptimistic
ApproachPessimisticPessimisticOptimistic
Order decidedDynamically, by who locks firstIn advance, by timestampAt the end, by validation order
On conflictWaitAbort at onceAbort at validation
DeadlockPossibleImpossibleImpossible
Best forUpdate heavy workloadsRead heavy workloadsLow conflict workloads
Worst forLong transactions holding hot objectsFrequent conflict, since aborts are earlyFrequent conflict, since work is wasted
OverheadLock table on every operationTimestamps and several versions per objectRead and write sets, and tentative versions
Asked on the paper, word for word
  • Briefly explain different methods for concurrency control. What are the drawbacks of 2PL and how does strict 2PL overcomes those? 2080 Baishakh Q7 · 2+6
  • What do you mean by nested transactions? Explain optimistic concurrency control method with its advantages over other concurrency control methods. 2072 Chaitra Q8 · 2+4+2
  • What are the flat and nested transactions? Describe the methods for concurrency control in distributed system. 2069 Chaitra Q9 · 3+4

8.8Distributed transactions

Flat and nested distributed transactions PIN 3/22

81 Bh · 75 Ch · 70 Ch2+6

Distributed transaction A transaction that accesses objects managed by multiple servers. It requires that either all the servers involved commit, or all of them abort. One server acts as coordinator and ensures the same outcome everywhere.
Lecture note figure: a flat distributed transaction in which one client transaction calls three servers in sequence, beside a nested transaction in which the top level opens subtransactions that themselves open further subtransactions
Flat against nested. In a flat transaction the client calls the servers one at a time; in a nested one the top level opens subtransactions that may themselves open further ones. From the Chapter 8 lecture notes
  • Flat distributed transaction: a client makes requests to more than one server, and completes each request before going on to the next, so it accesses the servers' objects sequentially. Simple, and it cannot overlap the servers' work.
  • Nested distributed transaction: the top level opens subtransactions, each of which may open further subtransactions. Subtransactions at the same level run concurrently, so a client can call several servers at once, which is the performance argument for nesting.

Nested against distributed, the comparison papers ask for. The two words answer different questions, which is why the comparison confuses students:

Lecture note figure: a nested transaction whose subtransactions run against two different independent databases, beside a distributed transaction whose subtransactions run against two physically separated parts of the same database
The real difference. A nested transaction may span two independent databases; a distributed transaction spans two parts of the same logical database. From the Chapter 8 lecture notes
PointNested transactionDistributed transaction
What it describesThe structure: transactions inside transactionsThe location: one transaction across several servers
DataMay be two different independent databasesTwo physically separated parts of the same database
CommitSubtransactions commit provisionally; the top level decidesAll participants must commit or all abort, decided by the coordinator
Partial failureA subtransaction may abort and the parent continueAny participant aborting forces every participant to abort
ProtocolThe five nesting rulesAn atomic commit protocol, normally 2PC
ExampleBooking three flights, each committing separatelyTransferring money between accounts held by two banks

They are not exclusive: a transaction can be both, and a nested distributed transaction is the normal case in practice.

Asked on the paper, word for word
  • Compare nested transaction with distributed transaction. Explain two-phase commit protocol for handling distributed transactions. 2081 Bhadra Q8 · 2+6
  • Compare nested transactions and distributed transactions. Explain the two-phase commit protocol of handling distributed transactions. 2075 Chaitra Q8 · 2+6
  • Differentiate between nested transaction and distributed transaction with examples. How is commitment ensured in distributed transactions? 2070 Chaitra Q9 · 2+6

8.9Atomic commit protocols

One phase, and then two TOP 10/22

81 Bh · 81 Ba · 78 Bh · 76 Ch · 75 Ch · 72 Ka · 71 Shr · 70 Ch · 70 Asa · 69 Ch2+62+52+8

Why a protocol is needed. The atomicity of a transaction requires that when a distributed transaction ends, either all of its operations are carried out or none of them are. The client requested operations at more than one server, so an atomic commit protocol is designed to achieve that effect even if a server crashes during execution.

The three protocols, and what each adds:

  • One phase commit (1PC): the coordinator simply tells all the servers to commit. The problem: a server has no way to abort its part of the transaction, so if one of them cannot commit, for example because a concurrency control check failed, it has no way to say so. The protocol does not state what to do when a process cannot perform the operation.
  • Two phase commit (2PC): allows any server to abort its part of the transaction. This is what is actually used.
  • Three phase commit (3PC): avoids blocking the servers when the coordinator fails. Mostly described in the literature rather than used in practice.

The two phase commit protocol

It allows a server to decide to abort unilaterally, and includes timeout actions for delays caused by crashes. It can take an unbounded time to complete, but is guaranteed to complete eventually.

Lecture note figure: the finite state machines of two phase commit, the coordinator moving from init through wait to commit or abort, and the participant moving from init through ready to commit or abort
The state machines. (a) the coordinator: INIT, WAIT, then COMMIT or ABORT. (b) the participant: INIT, READY, then COMMIT or ABORT. Draw both when the question says "with state diagram". From the Chapter 8 lecture notes

Phase 1, the voting phase:

  1. When the coordinator is ready to commit, it places a Prepare(T) record in its log on stable storage.
  2. It sends Vote_request(T) to all the participants and waits for replies.
  3. Each participant receives the vote request.
  4. It places Abort(T) or Ready(T) in its own local log, on stable storage, before replying. This is the step that makes recovery possible.
  5. It replies with Abort(T) or Ready_to_commit(T).
  6. If it voted abort, it aborts the transaction locally at once.

Phase 2, the completion phase. At the coordinator:

  • If any participant replies abort, the coordinator writes Abort(T) to its log, sends Global_Abort(T) to all the participants, and aborts locally.
  • If all participants reply ready to commit, it writes Commit(T) to its log, sends Global_Commit(T) to all, and commits locally.

At each participant: wait for the global abort or global commit message, place Abort(T) or Commit(T) in the local log, and then abort or commit locally as instructed.

The big problem with two phase commit, which every 3PC question begins from:

  • It can lead to both the coordinator and the participants blocking, which may end in deadlock.
  • If the coordinator crashes while a participant is in the READY state, that participant cannot decide on its own: it has voted yes, so it may not abort, and it has not been told to commit, so it may not commit. It must hold its locks and wait until the coordinator recovers.
  • For that reason 2PC is called a blocking commit protocol, and the solution is the three phase commit protocol.
Asked on the paper, word for word
  • Compare nested transaction with distributed transaction. Explain two-phase commit protocol for handling distributed transactions. 2081 Bhadra Q8 · 2+6
  • What do you mean by Distributed Commit? What is the difference between two phase and three phase commit protocol? Explain. 2081 Baishakh Q7 · 2+8
  • What are the Flat and Nested Transactions? Explain how the problems of 2PC protocols are solved by 3PC. 2078 Bhadra Q9 · 2+6
  • Write short notes on: Two Phase commit protocol 2076 Chaitra Q9d · 3
  • Compare nested transactions and distributed transactions. Explain the two-phase commit protocol of handling distributed transactions. 2075 Chaitra Q8 · 2+6
  • How cascading aborts occurs and can be solved? Explain the needs and roles of atomic commit protocol in distributed system. 2072 Kartik Q8 · 8
  • Write short notes on (Any Three): Two Phase Distributed Commit 2071 Shrawan Q9c · 4
  • Differentiate between nested transaction and distributed transaction with examples. How is commitment ensured in distributed transactions? 2070 Chaitra Q9 · 2+6
  • What are the roles of atomic commitment protocol (ACP) in distributed transactions? Explain the different methods of concurrency control in distributed transactions. 2070 Ashad Q8 · 2+6
  • What do you mean by Distributed Deadlock? Explain the two-phase commit protocol of handling distributed transaction. 2069 Chaitra Q8 · 2+5

8.10Three phase commit

The extra state that unblocks the participants HOT 6/22

81 Ba · 80 Bh · 79 Bh · 78 Bh · 76 Ch · 74 Ash2+62+84+4

The idea in one sentence. 2PC blocks because a participant in READY cannot tell whether the coordinator decided commit or abort. 3PC inserts a precommit state between them, so that a participant which has reached precommit knows that everybody voted yes, and can therefore go ahead and commit on its own if the coordinator disappears.

Lecture note figure: the finite state machines of three phase commit, with the extra precommit state between ready and commit on both the coordinator and the participant
The state machines. Compare with 2PC: the only structural change is PRECOMMIT between WAIT or READY and COMMIT, and that one box is what removes the blocking. From the Chapter 8 lecture notes

The coordinator:

  • Phase 1. It receives a transaction request. If it fails at this point, it aborts the transaction, that is, on recovery it will treat it as aborted. Otherwise it sends canCommit? to the participants and moves to the waiting state.
  • Phase 2. If there is a failure or a timeout, or if it receives a No in the waiting state, it aborts and sends abort to all participants. Otherwise it receives Yes from all of them within the time window, sends preCommit to all participants, and moves to the prepared state.
  • Phase 3. If it succeeds in the prepared state it moves to the commit state. If it times out waiting for an acknowledgement from a participant it aborts the transaction. When all acknowledgements are received it moves to commit.

The participants:

  • Phase 1. A participant receives canCommit?. If it agrees it sends Yes and moves to the prepared state; otherwise it sends No and aborts. If it fails, it moves to the abort state.
  • Phase 2. In the prepared state, if it receives abort, fails, or times out waiting for a commit, it aborts. If it receives preCommit it sends an ACK and awaits a final commit or abort.
  • Phase 3. If after receiving preCommit the coordinator fails or times out, the participant goes forward with the commit. That is the whole point of the protocol.

How 3PC solves the problems of 2PC. Because no participant can be in precommit unless every participant voted yes, any participant that survives can decide correctly without the coordinator: if it is in precommit it commits, and if it is only in ready it aborts. So the protocol is non blocking under a crash of the coordinator.

Why it is not used in practice, a line that earns the last mark: it costs an extra round of messages on every transaction, it assumes a synchronous system with reliable timeouts, and it still fails under a network partition, where two groups can reach opposite decisions. Real systems prefer 2PC with a recovery log, or Paxos.

Asked on the paper, word for word
  • What do you mean by Distributed Commit? What is the difference between two phase and three phase commit protocol? Explain. 2081 Baishakh Q7 · 2+8
  • What are the solutions to avoid deadlock in distributed system? Explain three phase commit protocol on handling distributed transactions. 2080 Bhadra Q8 · 4+4
  • Explain snapshot algorithm used for backward recovery in distributed system. Explain three phase commit protocol with state diagram. 2079 Bhadra Q8 · 6+4
  • What are the Flat and Nested Transactions? Explain how the problems of 2PC protocols are solved by 3PC. 2078 Bhadra Q9 · 2+6
  • Write short notes on: Three Phase Commit. 2076 Chaitra Q9a · 3
  • How cascading aborts occurs and solved? Explain three phase commit protocol with state diagram. 2074 Ashwin Q8 · 8

8.11Concurrency control in distributed transactions

The same three methods, now spread across servers PIN 2/22

71 Ch · 70 Asa1+4+32+6

Each server applies concurrency control to its own objects, and the question is how the servers' decisions are made to agree.

  • Locking. Each server maintains its own locks for its own objects, and cannot release them until it knows the transaction has committed or aborted everywhere, which is why locking is combined with two phase commit. The consequence is distributed deadlock, because the wait for relationships now span servers and no single server can see the cycle.
  • Timestamp ordering. The coordinator issues a globally unique timestamp, usually the pair (local time, server identifier), and passes it to every server with the request. Every server then orders the operations of the transaction by that one timestamp, so the same serial order is enforced everywhere. This requires the servers' clocks to be roughly synchronised, which is chapter 5's problem returning.
  • Optimistic concurrency control. Each server validates the transaction's operations on its own objects, but a transaction may pass validation at one server and fail at another. So validation must itself be made global: the servers validate in a fixed order, or the commit is done in two phases with validation in the first phase.

The pattern to notice: each method needs a different extra thing when it is distributed. Locking needs deadlock detection, timestamp ordering needs synchronised clocks, and optimistic control needs a global validation order.

Asked on the paper, word for word
  • Define lock in concurrency control. How can concurrency be controlled in distributed transactions? What situation does lead to distributed deadlock? 2071 Chaitra Q8 · 1+4+3
  • What are the roles of atomic commitment protocol (ACP) in distributed transactions? Explain the different methods of concurrency control in distributed transactions. 2070 Ashad Q8 · 2+6

8.12Distributed deadlocks

Cycles that no single server can see TOP 9/22

81 Ba · 80 Bh · 76 Ch · 76 Ash · 75 Ch · 74 Ash · 73 Shr · 71 Ch · 69 Ch4+441+4+3

Deadlock The situation in which two transactions are waiting and each depends on the other to release a lock before it can resume; more generally, a state in which each member of a group of transactions is waiting for some other member to release a lock.
Lecture note table: transaction T locking A and then waiting for U's lock on B, while transaction U locks B and waits for T's lock on A, which is a deadlock
The simplest deadlock. T holds A and wants B; U holds B and wants A. Neither can proceed and neither will give way. From the Chapter 8 lecture notes

The four necessary conditions, which are the same as in an operating system: mutual exclusion, each resource is either assigned to exactly one process or is free; hold and wait, processes hold resources while waiting for more; no preemption, resources cannot be taken away; and circular wait, a chain of processes each waiting for one held by the next.

Two kinds in a distributed system:

  • Resource deadlock: each deadlocked process waits for a resource held by another, such as a data object or an I/O resource. The common case.
  • Communication deadlock: each deadlocked process waits to receive a message from another process in the set.

Detection

A wait for graph is used to detect deadlock by finding cycles, and when one is found a transaction is selected to be aborted, which is not a simple choice. The distributed difficulty is that the graph is split across the sites.

Lecture note figure: local wait for graphs held at two sites, each showing processes waiting on one another plus an external node, with a cycle that appears only when the two graphs are combined
Why it is hard. Neither site's local graph contains a cycle on its own. The cycle only exists in the union of the two, which nobody holds. From the Chapter 8 lecture notes
  • Centralized detection. Each site keeps a local wait for graph and a single coordinator keeps the global one. The controller sends an initiating message to each site; each site replies with its local graph; the controller builds a graph with a vertex for every process and an edge wherever one appears in any local graph, and a cycle means deadlock. Simple, and it is a bottleneck and a single point of failure.
  • Hierarchical detection. The sites are organised as a tree; each non leaf node holds information about its dependants; deadlock is detected by the lowest common ancestor of the sites whose allocations conflict, so it is detected at the lowest level that can see it.
  • Distributed detection. All sites share the responsibility, the global graph is spread over many sites, and detection is initiated when a process is suspected of being deadlocked. Advantages: no single point of failure and no congestion. Disadvantage: difficult to implement.

Two families of distributed algorithm:

  • Path pushing: each node builds a wait for graph from its own information and what other sites send it, resolves the local deadlocks, and transmits the remaining waiting paths to other sites.
  • Edge chasing: special messages called probes are sent along the edges of the wait for graph. A blocked process receiving a probe forwards it on its own outgoing edges, and when a process receives a probe it initiated itself, a cycle exists and it declares deadlock. This is the standard distributed answer, and the probe carries the transaction identifiers so that a victim can be chosen.
  • Fully distributed approach: every site builds the part of the graph it can see, plus one extra node Pex standing for the outside world. A cycle that does not involve Pex means the system is deadlocked; a cycle through Pex means a deadlock is only possible, and a distributed detection algorithm must be run to find out.

The phantom deadlock, asked by name in 2076 Ashwin: a deadlock that the detector reports but which does not actually exist. It happens because the local graphs are collected at different moments, so the union may contain an edge that has already gone, for example because a transaction aborted on its own between the two snapshots. The cost is an unnecessary abort, and it is avoided by validating the cycle before acting on it, or by using edge chasing, whose probe travels along edges that still exist.

Prevention and avoidance

  • Lock all the objects when the transaction starts. It removes hold and wait, and the notes call it "not a good way", because the transaction must know everything it will touch and it destroys concurrency.
  • Request locks in a predefined order. It removes circular wait, at the price of premature locking and reduced concurrency.
  • Timeouts. Each lock is given a limited period during which it is invulnerable; after that a waiting transaction is aborted. Simple and widely used, and it sometimes aborts a transaction that was not deadlocked at all, so the length of the timeout is a difficult choice.

Two timestamp based avoidance schemes, which are the usual named answers:

  • Wait-die, non preemptive. If Pi requests a resource held by Pj, Pi is allowed to wait only if it has a smaller timestamp, that is if it is older; otherwise it is rolled back, it dies. With timestamps 5, 10 and 15 for P1, P2 and P3: if P1 requests a resource held by P2 it waits, and if P3 requests one held by P2 it is rolled back.
  • Wound-wait, preemptive, the counterpart. Pi is allowed to wait only if it has a larger timestamp, that is if it is younger; otherwise Pj is rolled back, it is wounded. With the same timestamps: if P1 requests a resource held by P2, the resource is preempted and P2 is rolled back; if P3 requests one held by P2, P3 waits.

Why both work: each rule allows waiting in only one direction along the timestamp order, so a circular wait cannot form. And in both, a rolled back transaction restarts with its original timestamp, so it eventually becomes the oldest and cannot starve.

Asked on the paper, word for word
  • Write short notes on: Distributed Deadlock and its avoidance approaches 2081 Baishakh Q8a · 5
  • What are the solutions to avoid deadlock in distributed system? Explain three phase commit protocol on handling distributed transactions. 2080 Bhadra Q8 · 4+4
  • What are the alternative approaches to avoid possibility of deadlock in distributed system? Explain. 2076 Chaitra Q8 · 4+4
  • Why is it necessary to maintain transaction? What is a deadlock and what are phantom deadlocks. 2076 Ashwin Q8 · 8
  • Write short notes on: Distributed deadlock 2075 Chaitra Q10b · 4
  • Write short notes on: Distributed deadlock and recovery 2074 Ashwin Q10a · 4
  • What is LOCK and DEADLOCK in DS? Discuss the methods of distributed deadlock avoidance. 2073 Shrawan Q8 · 4+6
  • Define lock in concurrency control. How can concurrency be controlled in distributed transactions? What situation does lead to distributed deadlock? 2071 Chaitra Q8 · 1+4+3
  • What do you mean by Distributed Deadlock? Explain the two-phase commit protocol of handling distributed transaction. 2069 Chaitra Q8 · 2+5

8.13Last minute recall

Chapter 8 in one screen

  • ACID: atomicity, consistency, isolation, durability.
  • Two problems: lost update and inconsistent retrieval. The cure is serial equivalence.
  • Nested commit rules: parent waits for children; a child commits provisionally; a parent aborting kills the children; a child aborting need not kill the parent; the top level commit makes the provisional ones real.
  • Lock rules: read and read share; anything with a write waits. Two phase locking: no new lock after the first release. Strict 2PL: hold until commit.
  • Drawbacks of locking: overhead, deadlock, reduced concurrency, starvation. Cascading aborts come from dirty reads and are cured by strict 2PL.
  • Optimistic: working, validation, update. Three conflict rules. Backward validation against committed transactions, forward against active ones.
  • Timestamp ordering: write allowed if Tc max read timestamp and Tc> committed write timestamp, else abort; read from the newest committed version not later than Ti, else abort.
  • Comparison: timestamps suit read heavy work and abort at once; locks suit update heavy work and make you wait; optimistic lets everybody run.
  • Distributed transaction: flat is sequential, nested runs subtransactions concurrently. Nested is about structure, distributed is about location.
  • 2PC: voting phase (prepare, vote_request, ready or abort) and completion phase (global_commit or global_abort). Blocking if the coordinator dies while a participant is READY.
  • 3PC: canCommit, preCommit, doCommit. A participant in precommit knows everybody voted yes, so it can commit alone. Non blocking, costs a round, and still fails under partition.
  • Deadlock detection: wait for graph, centralized, hierarchical or distributed. Edge chasing with probes. Phantom deadlock from stale snapshots. Prevention: lock everything at the start, ordered locking, or timeouts. Avoidance: wait-die and wound-wait.

Chapter 9 · 4 hours · about 6 marks a paper · in 18 of 22 sittings

Fault tolerance

Things break. This chapter names exactly what breaks and how badly, groups processes so that one death does not matter, makes a remote call survive a crash at either end, and finally puts the system back together after a failure that was not masked. Every paper sets a question here, usually opening with "define fault, error and failure".

What this chapter is about
  • The vocabulary: fault, error, failure, and the five dependability requirements.
  • Process resilience: groups, flat and hierarchical, and how many replicas a given fault model needs.
  • Reliable client server communication: the five things that can go wrong in an RPC and what to do about each.
  • Reliable group communication and atomic multicast.
  • Recovery: backward and forward, checkpointing, the domino effect, and message logging.
Where it fits
  • The replication of chapter 7 is how process resilience is actually built.
  • Distributed commit is chapter 8's 2PC and 3PC seen as a fault tolerance problem.
  • Checkpointing is the snapshot of chapter 5, used backwards.
  • Agreement in a faulty system is chapter 6's Byzantine generals, and this chapter gives Lamport's vector algorithm for it.
What you will learn
  1. 9.1 Fault, error, failure and dependability
  2. 9.2 Process resilience and groups
  3. 9.3 How much replication: k fault tolerance and TMR
  4. 9.4 Agreement in a faulty system
  5. 9.5 Reliable client server communication
  6. 9.6 Reliable group communication
  7. 9.7 Distributed commit
  8. 9.8 Recovery: backward and forward
  9. 9.9 Checkpointing and message logging
  10. 9.10 Last minute recall, chapter 9
How it is examined
  • "Define fault, error and failure" opens the question in nine sittings, worth two to four marks. Three sentences, no more.
  • Recovery is the other half: "forward and backward recovery" and "checkpointing approach" together appear in eleven sittings.
  • Process resilience is a short note in five sittings: groups, flat and hierarchical, and the k+1 and 2k+1 numbers.

9.1Fault, error and failure

The three words, and the five requirements TOP 9/22

81 Bh · 80 Bh · 80 Ba · 76 Ch · 76 Ash · 71 Shr · 70 Ch · 70 Asa · 69 Ch2+2+43+54+4

Fault, error, failure A fault is a defect within a hardware or software unit. An error is a deviation from accuracy, that is the wrong internal state a fault produces. A failure is the condition that occurs when an error causes the system to function incorrectly, which is when the user sees it.

Read them as a chain and the distinction stops being fussy: a fault is the cause, an error is the state, a failure is the visible effect. A fault may sit in a system for years without producing an error, and an error may be corrected before it becomes a failure. That is precisely what fault tolerance does.

Fault tolerance The ability to provide services despite faults occurring in some node of the system. A system is k fault tolerant if it can function properly even when k nodes suffer concurrent failures.

The five dependability requirements, which is a direct four mark question:

  • Availability: the system should be available for use at any given time.
  • Reliability: the system should run continuously without failure.
  • Safety: a temporary failure should not result in a catastrophe.
  • Maintainability: a failed system should be easy to repair.
  • Security: deliberate attacks on the system should be avoided or tolerated.

Availability against reliability is the pair students confuse. A system that fails for one millisecond every hour is highly available and unreliable; a system that never fails but is down for maintenance one day a month is reliable and less available.

Types of fault, by where they sit: node fault, program fault, communication fault and timing fault.

Types of fault, by how long they last: transient, which occurs once and disappears; intermittent, which comes and goes, such as a loose connector; and permanent, which continues until it is repaired.

Types of failure, by what the component does wrong, which is the list the failure model in chapter 1 named:

Failure typeWhat happens
Crash, or fail silentThe server halts and stays halted; it was working correctly until it stopped
OmissionA server fails to receive a request, or fails to send a reply
TimingThe response is correct but arrives outside the specified time interval
ResponseThe response is wrong: the wrong value, or the wrong state change
Arbitrary, or ByzantineThe server produces arbitrary responses at arbitrary times, possibly maliciously

The order matters: each row is harder to tolerate than the one above, and arbitrary failure is the hardest because a faulty component can imitate a correct one.

Asked on the paper, word for word
  • Define fault, error and failure. How do you detect arbitrary faults and recover it? Explain. 2081 Bhadra Q9 · 3+5
  • Define faults, failures and errors. How to achieve agreement in faulty system over reliable channel? Explain. 2080 Bhadra Q9 · 4+4
  • Define faults, error and failures. How reliable client server communication can be achieved in DS? 2080 Baishakh Q8 · 3+5
  • What is fault? How to implement primary-backup replica system? How is it differ from active replication? 2076 Chaitra Q6 · 2+4+2
  • What is fault tolerance? Explain different type of faults that may occur in a distributed system. 2076 Ashwin Q9 · 8
  • How do you avoid faults in DS? Compare independent chekpointing with coordinated checkpointing approach. 2071 Shrawan Q8 · 4+4
  • What do you mean by fault tolerant system? What do you mean by Byzantine Failure? Explain Byzantine Generals problem to illustrate how agreement can be reached in faulty system. 2070 Chaitra Q10 · 1+2+5
  • What are the dependability requirements of fault tolerant system? What do you mean by K-fault tolerant? How to come agreement in faulty system? Explain with the approach of byzantine generals problem. 2070 Ashad Q9 · 2+2+4
  • What do you mean by faults, failures and errors? How do you handle faults in Distributed System? Explain process resilience approach in brief. 2069 Chaitra Q10 · 2+2+4

9.2Process resilience

Groups of identical processes, flat or hierarchical HOT 5/22

78 Bh · 74 Ash · 73 Shr · 71 Ch · 69 Ch42+2+43

Process resilience A mechanism to protect against faulty processes by replicating and distributing computations in a group. Processes are made fault tolerant by arranging a group of identical processes: a message sent to the group is delivered to all of its members, and only one of them performs the required service. If a process fails, one of the others is still able to function and serve the pending request.

Why a group is the right abstraction. The client addresses the group, not a machine, so members can be added and removed without the client knowing. That makes the group a single logical service whose membership is allowed to change, which is what "resilience" means in practice.

The two organisations, and papers ask you to compare them:

PointFlat groupHierarchical group
RolesAll processes have equal rolesOne process is the coordinator and handles all communication
ControlCompletely distributed among the processesCentralised in the coordinator
Fault toleranceGood: information is exchanged immediately and no member is specialNot completely fault tolerant: the coordinator is a single point of failure
ScalabilityPoor: every decision needs agreement among all membersPoor for a different reason: the coordinator becomes a bottleneck
OverheadImposes more overhead, because decisions are collectiveLow, since the coordinator decides alone
ImplementationDifficult to implementEasy to implement

The three things a group buys you, for a short answer:

  • Masking: one member failing is invisible to the client, since another answers.
  • Transparency: the client addresses the group, not a machine, so members may join and leave.
  • Scale: read load is shared among the members, as in chapter 7's replication.

Group membership management is the part that makes this real: a service must keep the membership list current, tell the members when it changes, and handle the case of a member failing rather than leaving politely. In a flat group the failure of the membership service itself must be handled too.

Asked on the paper, word for word
  • Write short notes on: Process Resilience 2078 Bhadra Q10d · 4
  • Write short notes on: Process Resilience 2074 Ashwin Q10c · 4
  • Write short notes on: Process Resilience 2073 Shrawan Q9a · 3
  • Write short notes on: Process Resilience 2071 Chaitra Q9d · 4
  • What do you mean by faults, failures and errors? How do you handle faults in Distributed System? Explain process resilience approach in brief. 2069 Chaitra Q10 · 2+2+4

9.3How much replication is needed

k fault tolerance, and triple modular redundancy HOT 4/22

75 Ch · 75 Ash · 74 Ash · 70 Asa2+2+42+63+5

k fault tolerant A system is k fault tolerant if it can survive faults in k components and still meet its specification.

The two numbers to quote, and each with its reason:

  • k+1 processors tolerate k fail-stop faults. A fail-stop processor just stops, so if k of them fail, the one left still gives the correct answer and can be believed.
  • 2k+1 processors tolerate k Byzantine faults. A Byzantine processor keeps running and gives wrong answers, so the correct ones must outvote it: if k send wrong replies, k+1 still give the correct one, and a majority vote recovers it.

The third number, for the agreement problem rather than simple voting: 3k+1 processes are needed to reach agreement among themselves with k Byzantine faulty ones, which is chapter 6's result. Voting on an answer needs a majority; agreeing on a value when the sender may also lie needs two thirds.

Triple modular redundancy

Lecture note figure: triple modular redundancy, three copies of each stage A, B and C, with a voter after each stage that takes three inputs and outputs the value that at least two of them agree on
TMR. Every element is tripled and followed by three voters, so one failure per stage is masked before it can reach the next stage. From the Chapter 7 lecture notes

How TMR works. Each device is replicated three times, and each stage of the circuit is followed by a triplicated voter. A voter has three inputs and one output: if two or three of the inputs are the same, the output is that input; if all three differ, the output is undefined.

The worked case. Suppose element A2 fails. Each of the voters V1, V2 and V3 gets two good inputs and one rogue one, and each outputs the correct value, so the inputs to B1, B2 and B3 are exactly what they would have been with no fault at all: the failure is completely masked. If B3 and C1 also fail, those are masked in the same way, and the three final outputs are still correct. A 747 flies on three of its four engines by the same logic.

The three kinds of redundancy that buy fault tolerance: information redundancy, extra bits to recover a garbled value; time redundancy, doing the operation again, which helps only against transient faults; and physical redundancy, extra components, arranged either as active replication or as primary backup.

Asked on the paper, word for word
  • What do you learn from Byzantine generals problem? Explain the basic principle of K-fault tolerant. 2075 Chaitra Q9 · 3+5
  • How does triple modular redundancy works? Explain how reliable client server communication can be achieved in distributed system. 2075 Ashwin Q10 · 4+4
  • What is K-fault tolerant system? Explain fault recovery techniques. 2074 Ashwin Q9 · 2+6
  • What are the dependability requirements of fault tolerant system? What do you mean by K-fault tolerant? How to come agreement in faulty system? Explain with the approach of byzantine generals problem. 2070 Ashad Q9 · 2+2+4

9.4Agreement in a faulty system

Lamport's algorithm, in four steps

Chapter 6 asked whether agreement is possible; this card is how it is actually done when the faulty node can generate arbitrary data, pretending to be correct. The problem is posed as: can N generals reach agreement over a perfect channel if M of them may be traitors?

The four steps:

  1. Every non faulty process i sends its value vi to every other process by reliable unicast. A faulty process may send anything, including a different value to each recipient.
  2. The results of step 1 are collected together by each process in the form of a vector.
  3. Every process passes its vector to every other process, so each may receive up to N1 vectors.
  4. Each process examines the ith element of each of the newly received vectors. If any value has a majority, that value is put into the result vector; if no value has a majority, that element is marked UNKNOWN.
Lecture note figure: four processes fully connected, one of them shaded as the faulty process, each sending its troop strength to the other three and the faulty one sending different values x, y and z
Step 1 with four processes. Process 3 is faulty and sends x, y and z to the three others instead of one value. From the Chapter 9 lecture notes
Lecture note figure: the vectors each process assembles from the values it received, and the vectors each process receives when those vectors are exchanged in the third step, from which the majority is taken element by element
Steps 2 and 3. (b) the vector each process assembles; (c) the vectors it then receives. Taking the majority down each column gives (1, 2, UNKNOWN, 4), and all three correct processes agree on it. From the Chapter 9 lecture notes

The result: with m faulty processes, agreement is possible only if 2m+1 processes function correctly, that is only if more than two thirds of the processes are correct. With N=4 and m=1 the correct processes agree on everything except the faulty one's own value, which is marked unknown, and that is enough.

Why N=3 with m=1 fails. With two correct processes and one faulty one, each correct process ends up comparing two conflicting values with no third to break the tie, so no value has a majority and no agreement is reached.

9.5Reliable client server communication

Five things that go wrong, and five answers PIN 2/22

80 Ba · 75 Ash3+54+4

This is the most mechanical question in the chapter and therefore the easiest to answer in full: name the five failure classes, then give the remedy for each.

Lecture slide: three cases of a server crash during a request, the normal case where the server receives, executes and replies, the case where it crashes after executing but before replying, and the case where it crashes before executing
The awkward middle case. (a) the server replies normally; (b) it crashes after executing; (c) it crashes before executing. From the client's side (b) and (c) look identical, which is the whole difficulty. From the Chapter 9 fault tolerance slides
What goes wrongWhat is done about it
The client cannot locate the server, because it is down or its interface has changedReport back to the client with an exception. The failure is not hidden, because nothing can be done about it in the middleware.
The client's request is lostResend the message after a timeout. If the server never received it, the retransmission is harmless.
The server crashes after receiving the requestDepends on the RPC semantics chosen: at least once keeps retrying until the server is back, at most once gives up and reports failure, and maybe gives no guarantee at all. Exactly once cannot be achieved in general, because the client cannot tell case (b) from case (c) above.
The server's reply is lostRetransmit, and make the operations idempotent so that repeating one is harmless; where an operation cannot be made idempotent, the server keeps a sequence number per client and returns the stored reply instead of re-executing.
The client crashes after sending the requestKill the orphan computation. The work the server is still doing on behalf of a dead client is an orphan: it holds locks and consumes resources for nobody.

Four ways to deal with orphans, which is worth naming if the question is worth four marks or more:

  • Extermination: the client logs every call before making it, and on recovery reads the log and kills the orphans. Expensive and thorough.
  • Reincarnation: the client's recovery starts a new epoch, broadcast to all machines, and every computation from an older epoch is killed.
  • Gentle reincarnation: the same, but a computation is killed only if its owner really cannot be located.
  • Expiration: each computation is given a fixed quantum of time and must ask for another, so an orphan dies of its own accord.

The one line summary: reliable client server communication is achieved by acknowledgements and retransmission for lost messages, by idempotent operations or reply caching for duplicates, by a choice of invocation semantics for server crashes, and by orphan detection for client crashes.

Asked on the paper, word for word
  • Define faults, error and failures. How reliable client server communication can be achieved in DS? 2080 Baishakh Q8 · 3+5
  • How does triple modular redundancy works? Explain how reliable client server communication can be achieved in distributed system. 2075 Ashwin Q10 · 4+4

9.6Reliable group communication

Reliable multicast and atomic multicast PIN 1/22

75 Ch4

The problem. A message multicast to a group may be lost on the way to some members, an acknowledgement may be lost, and if every receiver reports, the sender is overwhelmed. So reliable group communication has to solve delivery and feedback at the same time.

Lecture slide: reliable one to many communication, showing a receiver that missed a message, an acknowledgement based scheme in which every receiver acknowledges, and a negative acknowledgement scheme in which only the receiver that missed the message reports it
Two schemes. Above, every receiver acknowledges, and the sender becomes a bottleneck. Below, only the receiver that missed a message sends a negative acknowledgement, and the others suppress their own. From the Chapter 9 fault tolerance slides
  • ACK based schemes: every receiver acknowledges every message, so the sender knows exactly who has it. Correct, and the sender can become a bottleneck, which is the feedback implosion problem.
  • NACK based schemes: a receiver reports only a gap in the sequence numbers, and multicasts that report so the others suppress their own feedback. Scales to large groups, and the sender must keep a history buffer because it does not know when a message may safely be discarded.
Atomic multicast A guarantee that all the processes received the message or none at all, and that all of them receive messages in the same order. It is reliable multicast plus total ordering.

Why atomicity matters: a replicated database must apply the same updates in the same order at every replica, and a message delivered to half the group would split the replicas permanently.

How a process crash is handled: by a group view. Every message is associated with a view of the group, the set of members at the time it was sent, and all the processes in the group must agree on that view. That is virtual synchrony: a message is delivered to all the members of the view or to none, and a view change acts as a barrier, so a process that crashes is simply removed from the next view and its unfinished messages are either completed for everyone or dropped for everyone.

Asked on the paper, word for word
  • Write short notes on: Reliable Group Communication 2075 Chaitra Q10a · 4

9.7Distributed commit

All or nothing, across a group PIN 3/22

81 Ba · 72 Ka · 70 Asa4+2+22+84

Distributed commit The problem of having an operation performed by each member of a group of processes, or by none of them at all. It generalises the transaction commit of chapter 8: for a reliable multicast the operation is the delivery of a message, and for a distributed transaction it is committing the transaction.

Three protocols, and what each fixes:

  • One phase commit: the coordinator tells every process to perform the operation. The flaw is that a process has no way to refuse, so the protocol cannot handle a participant that is unable to carry out the operation.
  • Two phase commit: a voting phase in which the coordinator asks and every participant answers ready or abort, then a completion phase in which the coordinator announces global commit or global abort. Any participant may veto. Its flaw is that a participant which has voted yes and then loses the coordinator is blocked, holding its locks until the coordinator returns.
  • Three phase commit: inserts a precommit state between ready and commit, so a participant that reached precommit knows everybody voted yes and may commit on its own. It is non blocking under a coordinator crash, costs an extra round, and still fails under a network partition.

The fault tolerance reading of it: every step is written to stable storage before the message that depends on it is sent, so a participant that crashes and recovers can read its log, ask the others what was decided, and reach the same outcome. That is what makes the protocol a recovery mechanism and not only an agreement mechanism.

The full protocols, with their state machines, are in chapter 8.

Asked on the paper, word for word
  • What do you mean by Distributed Commit? What is the difference between two phase and three phase commit protocol? Explain. 2081 Baishakh Q7 · 2+8
  • How threads differ from process? How does checkpoint help in recovery? What does distributed commit refer to? 2072 Kartik Q4 · 4+2+2
  • Write short notes on: Distributed commit 2070 Ashad Q11b · 4

9.8Recovery

Backward and forward recovery TOP 9/22

81 Bh · 81 Ba · 80 Bh · 79 Bh · 76 Ch · 75 Ch · 74 Ash · 72 Ka · 71 Ch42+62+8

Where recovery sits. Everything before this card tried to mask a fault. Recovery is what happens when masking failed: the operations that must be performed after a failure to bring the system back to a correct state.

Backward recovery Bring the system back to a previous correct state, recorded before the error occurred, and continue from there. It needs checkpoints.
Forward recovery Bring the system to a new correct state from which it can continue, without going back. It needs the possible errors to be known in advance.
PointBackward recoveryForward recovery
DirectionReturn to a past stateMove on to a new correct state
What it needsCheckpoints or a log on stable storageKnowledge of every error that may occur, in advance
GeneralityGeneral: it works for any errorLimited: it handles only the anticipated errors
CostExpensive: state must be saved regularly, and work since the checkpoint is repeatedCheap at run time, and expensive to design
Repeated workYes, everything after the checkpoint is redoneNo
ExampleRolling a transaction back to its last checkpointAn erasure correcting code that reconstructs a lost packet from the ones received
ProblemIt cannot undo effects on the outside world, such as money paid outAn unanticipated error is not recovered at all

The one thing backward recovery cannot do, and it is worth a mark: some actions are irreversible. A cash machine that has handed out notes, a message already sent to another organisation, a missile already launched, none of these can be rolled back by restoring a checkpoint.

Recovery of a transaction, with UNDO and REDO

In a transactional server, recovery uses the recovery file, a log holding the history of all the transactions performed: the values of objects, the transaction status entries and the intentions lists, in the order in which the transactions prepared, committed and aborted. It begins with a recent snapshot of all the object values, followed by the history since.

  • UNDO removes the effects of faulty transactions: an INSERT is undone by deleting the item, a DELETE by reinserting it from the log, and an UPDATE by writing back the before image held in the log.
  • REDO reapplies the transactions that were not faulty but were undone as collateral damage, by replaying their inserts, deletes and updates from the log.

Shadow paging is the alternative to a log, for serially executed transactions: two page tables are kept, the current one and the shadow one held in non volatile storage. The shadow is never modified; a page about to be written for the first time is copied, and the current table is pointed at the copy. To commit, the modified pages and the current table are flushed and a pointer at a known location is switched to the new table. Its advantages are that there is no log writing overhead and recovery is trivial; its disadvantages are that copying the page table is expensive, commit overhead is high, and the data becomes fragmented.

Asked on the paper, word for word
  • Define fault, error and failure. How do you detect arbitrary faults and recover it? Explain. 2081 Bhadra Q9 · 3+5
  • Write short notes on: Backward recovery technique in DS 2081 Bhadra Q10c · 4
  • What is byzantine problem? Explain the backward recovery approaches in DS. 2081 Baishakh Q6 · 2+8
  • Write short notes on: Backward recovery Technique in DS 2080 Bhadra Q10b · 4
  • Explain snapshot algorithm used for backward recovery in distributed system. Explain three phase commit protocol with state diagram. 2079 Bhadra Q8 · 6+4
  • What do you mean by forward and backward recovery? How to implement coordinated check pointing for recovery in DS? 2076 Chaitra Q7 · 2+6
  • Write short notes on: Forward and Backward recovery in distributed system 2075 Chaitra Q10c · 4
  • What is K-fault tolerant system? Explain fault recovery techniques. 2074 Ashwin Q9 · 2+6
  • Write short notes on: Recovery approach in Distributed System 2072 Kartik Q9b · 3
  • Explain Byzantine general problem to handle faulty process with example. Describe any one failure recovery technique. 2071 Chaitra Q7 · 8

9.9Checkpointing and message logging

Independent against coordinated, and the domino effect HOT 4/22

78 Bh · 76 Ch · 72 Ka · 71 Shr4+2+22+63+4

Checkpoint A point in time at which the state of a process is written to stable storage, so that after a crash the process can be restarted from it rather than from the beginning.

The distributed difficulty. Saving one process's state is easy. The set of checkpoints, one per process, must form a consistent global state, that is a consistent cut in the sense of chapter 5: no checkpoint may record the receipt of a message that the sender's checkpoint does not record sending. The most recent consistent set of checkpoints is called the recovery line.

Independent checkpointing

Lecture slide: two process time lines with independent checkpoints and many messages between them, a failure at the end of one, and the rollback walking backwards through the checkpoints until a consistent cut is found
Rolling backwards. Each process checkpoints when it likes. After the failure the system must walk back through the checkpoints looking for a consistent cut, and each step back on one process may force a step back on the other. From the Chapter 9 fault tolerance slides

How it works: each process periodically checkpoints independently of the others, with no coordination at all. On a failure, the system works backwards to locate a consistent cut among the saved checkpoints, and all processes restart from it.

The problem, and its name. If the most recent checkpoints form an inconsistent cut, the system must keep rolling back until a consistent one is found. Each rollback can invalidate another process's checkpoint, so the rollbacks cascade, and in the worst case every process is forced back to the very beginning. That is the domino effect, and it is the standard reason given for preferring coordinated checkpointing.

Coordinated checkpointing

How it works: all the processes synchronise to write their local states at once, so the saved set is a distributed snapshot and is consistent by construction. On a failure, every process rolls back to the latest snapshot. The standard implementation is a two phase blocking protocol: a coordinator multicasts a CHECKPOINT_REQUEST, each process stops sending application messages, takes a local checkpoint and acknowledges, and the coordinator then multicasts CHECKPOINT_DONE to release them.

PointIndependent checkpointingCoordinated checkpointing
CoordinationNone: each process decides for itselfAll processes synchronise to checkpoint together
Run time costLow, and no messagesHigher: a synchronisation round and a pause
StorageSeveral checkpoints per process must be keptOnly the latest snapshot is needed
RecoverySearch backwards for a consistent cutRoll back to the last snapshot, with no search
Domino effectPossible, and in the worst case totalImpossible
ComplexitySimple to take, complicated to recoverComplicated to take, trivial to recover
Best whenProcesses rarely communicateProcesses communicate a great deal
Lecture note figure: four transactions on a time line against the checkpoint time and the failure time, one committed before the checkpoint, two committed between them and one still active at the crash
What the recovery manager does. A transaction committed before the checkpoint needs nothing; those committed between the checkpoint and the crash are redone; one still active at the crash is undone. From the Chapter 9 lecture notes

Two checkpointing styles in a transactional server, which the notes name: consistent checkpointing, in which the active transactions are suspended, all the buffers are written to disk, a checkpoint record is written to the log and the transactions resume; and fuzzy checkpointing, in which the active transactions are merely recorded in the log without suspending anything, so only those active at or after the checkpoint need be processed during recovery.

The three facts to carry about checkpointing:

  • A checkpoint set must be a consistent cut, or restarting from it restores a state that never existed.
  • Independent checkpointing risks the domino effect; coordinated checkpointing cannot.
  • The recovery line is the most recent consistent set of checkpoints, and it is what the system rolls back to.

Message logging

Why it exists: checkpointing is expensive, and taking checkpoints rarely means a great deal of computation must be redone after a crash. The compromise is to take infrequent checkpoints and log all the messages in between to local stable storage. To recover, a process restarts from its last checkpoint and replays the logged messages, which reconstructs the lost work without recomputing from a distant snapshot.

The assumption it rests on is the piecewise deterministic model: a process's execution between two messages is fully determined by its state and the message it received, so replaying the same messages reproduces the same states.

The thing to avoid is an orphan message: a message whose receipt has been recorded by a surviving process but whose sending was lost in the crash and cannot be replayed. Logging schemes are classified by how they prevent it: pessimistic logging writes each message to stable storage before it is delivered, which is safe and slow; optimistic logging writes in the background and rolls back orphans if a crash happens; and causal logging keeps the log in the causal dependencies carried on messages.

Asked on the paper, word for word
  • Discuss how Consensus can be achieved in Distributed System. Explain the check pointing approach for distributed recovery. 2078 Bhadra Q8 · 3+4
  • What do you mean by forward and backward recovery? How to implement coordinated check pointing for recovery in DS? 2076 Chaitra Q7 · 2+6
  • How threads differ from process? How does checkpoint help in recovery? What does distributed commit refer to? 2072 Kartik Q4 · 4+2+2
  • How do you avoid faults in DS? Compare independent chekpointing with coordinated checkpointing approach. 2071 Shrawan Q8 · 4+4

9.10Last minute recall

Chapter 9 in one screen

  • Fault is the defect, error is the deviation, failure is the system behaving incorrectly.
  • Dependability, five: availability, reliability, safety, maintainability, security.
  • Failure types: crash, omission, timing, response, arbitrary or Byzantine.
  • Process resilience: a group of identical processes. Flat is fault tolerant and hard; hierarchical is easy and has a single point of failure.
  • Replication needed: k+1 for fail-stop, 2k+1 for Byzantine voting, 3k+1 for Byzantine agreement.
  • TMR masks one fault per stage with three voters.
  • Lamport's agreement algorithm, four steps: send values, build a vector, exchange vectors, take the majority of each element and mark the rest UNKNOWN. Needs 2m+1 correct.
  • Five RPC failure classes: cannot locate the server, lost request, server crash, lost reply, client crash. Remedies: report, resend, choose the semantics, idempotence or reply cache, kill the orphan.
  • Orphan handling: extermination, reincarnation, gentle reincarnation, expiration.
  • Group communication: ACK based against NACK based, feedback implosion and suppression. Atomic multicast is all or none plus total order, implemented with group views and virtual synchrony.
  • Recovery: backward needs checkpoints and is general; forward needs the errors known in advance and is cheap.
  • Checkpointing: independent is cheap but suffers the domino effect; coordinated takes a distributed snapshot and rolls back to it. Message logging plus infrequent checkpoints avoids both extremes, and must avoid orphan messages.

Chapter 10 · 5 hours · about 2 marks a paper · in 12 of 22 sittings, always as short notes

Case studies

Four real systems, each showing one idea from the earlier chapters actually built: CORBA the object broker, Mach the microkernel, JINI the spontaneous federation of Java services, and TIB/Rendezvous the publish and subscribe bus. This chapter is where the last question of the paper lives, and it is the cheapest set of marks in the subject, because the answers are short and they repeat.

What this chapter is about
  • CORBA as a finished system rather than an architecture diagram.
  • Mach: the microkernel that made messages and memory the only two abstractions.
  • JINI: services that appear on the network and disappear again, with no administration.
  • TIB/Rendezvous: subject based addressing and a publish and subscribe bus.
  • The comparisons the paper asks for, especially CORBA against Mach.
Where it fits
What you will learn
  1. 10.1 CORBA as a case study
  2. 10.2 Mach
  3. 10.3 JINI
  4. 10.4 TIB/Rendezvous
  5. 10.5 Comparing the case studies
  6. 10.6 Last minute recall, chapter 10
How it is examined
  • Almost always as short notes, three or four marks each. MACH appears in six sittings and JINI in four.
  • Write five or six bullets, not prose. A four mark short note wants the definition, the components and one distinguishing feature.
  • One comparison question exists: "Comparison of CORBA and Mach" (2070 Chaitra), and it is answered by saying they solve different problems at different layers.

10.1CORBA as a case study

What CORBA got right, and why it faded

Chapter 4 covered the architecture; this card is CORBA as a system, which is what a case study question wants.

What it is: the Common Object Request Broker Architecture, specified by the Object Management Group, a non profit industry consortium formed in 1989. It is a specification, not a product: several vendors implemented it to varying degrees.

What it achieved, and these are genuine firsts:

  • Language neutrality. CORBA IDL plus language mappings let a C++ client invoke a Java server, which Java RMI cannot do.
  • Vendor neutrality through IIOP, the Internet Inter-ORB Protocol, so that one vendor's ORB could talk to another's over TCP/IP.
  • A standard set of services: naming, trading, transactions, concurrency, security, time, events, persistence and life cycle, so that applications did not each reinvent them.
  • Separation of interface from implementation, enforced by the IDL compiler, which is now taken for granted in every RPC framework.

Why it faded, worth a line because examiners like the judgement:

  • The specification was very large and vendors implemented different subsets, so portability between ORBs was poor in practice even though interoperability worked.
  • IIOP does not pass through firewalls easily, which mattered as systems moved onto the internet.
  • The programming model was heavy: IDL compilation, object adapters and repositories are a lot of machinery for one remote call.
  • Lighter alternatives arrived: Java RMI inside one language, then SOAP and finally REST and JSON over HTTP, which passed through firewalls and needed no compiler.

Its legacy is everywhere: stubs and skeletons, an interface description language, a naming service and a broker in the middle are the shape of gRPC and of every modern service mesh. CORBA lost the product battle and won the argument.

10.2Mach

Mach: two abstractions, and everything else in user space HOT 6/22

80 Ba · 79 Bh · 76 Ch · 76 Ash · 74 Ash · 73 Shr34

Mach A microkernel developed at Carnegie Mellon University from 1985, designed to support distributed and parallel computing while remaining compatible with UNIX. Its design principle is that the kernel provides only communication and memory management, and every other service runs as a user level server.

The five abstractions the kernel provides, which is the core of any Mach answer:

  • Task: an execution environment, that is an address space plus the rights to resources. A task is a process with no thread of control of its own.
  • Thread: the unit of execution. A task may hold many threads, which share its address space, so Mach separated the process from the activity long before it was common.
  • Port: a unidirectional message queue held and protected by the kernel. A port is the only way to name a service: to hold a send right to a port is to be allowed to talk to whatever is behind it, and only one task holds the receive right. A port set lets one thread wait on several ports at once.
  • Message: a typed collection of data sent to a port. Because the kernel understands the types, it can pass port rights and large regions of memory inside a message rather than copying bytes.
  • Memory object: a region of virtual memory whose backing store is managed by a user level external pager rather than by the kernel. This is what lets a file system, a database or a distributed shared memory be implemented outside the kernel.

The two ideas that make it fast, and they are the reason Mach is remembered:

  • Copy on write message passing. A large message is not copied; the receiving task's page table is made to point at the sender's pages, marked copy on write, so the copy happens only if somebody writes. A huge transfer therefore costs a few page table entries.
  • Location transparency through ports. A task sends to a port; whether the receiver is on the same machine or another is the business of the NetMsgServer, a user level process that forwards messages between machines. The same program works locally and distributed without change.
Textbook figure: a monolithic kernel drawn as one wide block containing all the server code, beside a microkernel drawn as a narrow block with the servers S1 to S4 as separate dynamically loaded processes above it
Mach is the right hand picture. A narrow kernel, with the file system, the network stack and even UNIX itself running as ordinary servers above it. From the Distributed Systems lecture notes

UNIX compatibility, the practical reason anyone used it: a BSD UNIX server runs as a user level task, so existing UNIX programs run unchanged while the system underneath is a microkernel.

Where it ended up: Mach is the base of NeXTSTEP and therefore of macOS and iOS, whose XNU kernel is Mach plus a BSD layer, and of the GNU Hurd. Its weakness is the classic microkernel one: a service call that used to be a function call becomes two messages and two context switches, which is why XNU puts the BSD layer back inside the kernel.

Asked on the paper, word for word
  • Write short notes on: MACH 2080 Baishakh Q9a · 4
  • Write short notes on: MACH 2079 Bhadra Q9e · 3
  • Write short notes on: MACH 2076 Chaitra Q9e · 3
  • Write short notes on any two: Mach 2076 Ashwin Q10c · 4
  • Write short notes on: MACH 2074 Ashwin Q10b · 4
  • Write short notes on: Mach 2073 Shrawan Q9b · 3

10.3JINI

JINI: services that plug in and unplug themselves HOT 4/22

80 Bh · 78 Bh · 72 Ch · 71 Ch44+2+2

JINI A coordination based system from Sun Microsystems, written in Java, that offers network plug and play of services: services may come and go without administration or reconfiguration, forming a federation rather than being centrally controlled.

The goals of JINI, which is asked directly (2071 Chaitra):

  • Spontaneous networking: communication is established dynamically, with no drivers installed and no manual configuration.
  • Plug and play of services, which are Java objects, so a device joining the network brings its own driver with it.
  • Federation, not central control: no single machine owns the system.
  • One language everywhere: written in Java, using RMI and Java object serialisation so that objects can move around the network.
  • Robust programming interfaces, which in practice means that failure is expected and is handled by leases rather than by administration.

The three main components:

  • Service: an entity another program, service or user can use, which may be a piece of computation, a hardware device or software.
  • Client: a JINI device or component that joins the federation in order to use a service.
  • Lookup service: the repository that keeps track of the services offered. It stores each service as a Java object, and clients download those objects on demand.

The three protocols that define its behaviour, and this is the list that earns the marks:

  1. Discovery: how to locate the lookup service. Done by multicast over UDP for lookup services at unknown locations, using group names, or by unicast when the address is already known. Both a client discovery at startup and a service announcement at startup exist, because otherwise a latecomer on either side would never be found.
  2. Join: how a service registers with the lookup service and exports itself, by registering a service proxy, a Java object, together with its attributes.
  3. Lookup: how a client finds a suitable service, by interface and by attributes, and then downloads the proxy and calls it directly.

The terminology to define, since a short note often asks for it:

  • Federation: the set of software components and devices that are part of a JINI network at a given time.
  • Leasing: JINI services grant resource usage in a time based manner. If the lease is not renewed before it expires, the grant is withdrawn. This is what cleans up after a device that was unplugged rather than shut down, and it is the single most copied idea in JINI.
  • Distributed event: components of a JINI system notify each other when some change in their state occurs.
  • Group: a name used to represent a community of services.

JavaSpaces

Clients and services still have to exchange information, and JINI does it with JavaSpaces, a tuple based storage system that gives temporal and referential uncoupling: the two sides need neither know each other nor be running at the same time.

Lecture note figure: a JavaSpace holding tuple instances, one process writing a copy of tuple A, another writing B, and a third presenting a template T, matching it against the stored tuples and taking back the matching tuple C
Write, read, take. Tuples go in as copies; a template with some fields left open comes in and is matched field by field; the match is returned, and optionally removed. From the Chapter 10 lecture notes
  • A tuple is a typed set of references to objects, stored in serialised form.
  • Write: a copy of a tuple is stored in the space.
  • Read: a template, with some fields left open, is compared field by field against the stored tuples, and the first match is returned.
  • Take: the same as read, except the matching instance is removed from the space.
Asked on the paper, word for word
  • Write short notes on: JINI 2080 Bhadra Q10a · 4
  • Write short notes on: JINI 2078 Bhadra Q10a · 4
  • Write short notes on: JINI 2072 Chaitra Q9b · 4
  • List the goals of JINI. What are CORBA services? How does operating system support for distributed system? 2071 Chaitra Q5 · 4+2+2

10.4TIB/Rendezvous

Rendezvous: address the subject, not the machine PIN 2/22

75 Ash · 71 Ch34

Start with the idea it belongs to. A coordination model separates computation from coordination, and the models differ in two kinds of coupling:

Lecture note table: the four coordination models arranged by temporal and referential coupling, direct when both are coupled, mailbox when referentially coupled and temporally decoupled, meeting oriented when referentially decoupled and temporally coupled, and generative communication when both are decoupled
The four models. Temporal coupling asks whether the two processes are alive at the same time; referential coupling asks whether they know each other explicitly. From the Chapter 10 lecture notes
  • Temporal coupling: are the cooperating processes alive at the same time?
  • Referential coupling: do they know each other explicitly?
  • Coupled on both gives direct communication, the ordinary remote call. Referentially coupled and temporally decoupled gives a mailbox. Referentially decoupled and temporally coupled gives meeting oriented communication, which is publish and subscribe. Decoupled on both gives generative communication, which is JavaSpaces.
Lecture note figure: publish subscribe middleware, a publisher putting a data item into the middleware, subscribers registering a subscription, and the middleware matching the two and delivering a notification
Publish and subscribe, in general. A publisher puts a data item in; a subscriber registers a description of what it wants; the middleware matches the two and delivers a notification. From the Chapter 10 lecture notes
TIB/Rendezvous A publish and subscribe system built on subject based addressing: a message is addressed to a subject rather than to a receiver. Receiving a message on subject X is possible only if the receiver has subscribed to X, and publishing on subject X sends it to all the currently running subscribers to X.
Lecture note figure: five machines each running an RV daemon and RV library, some publishing on subject A or B and others subscribed to them, with the daemons multicasting each message to exactly the subscribers of that subject
How it is implemented. Every machine runs an RV daemon and each process links the RV library. A publish becomes a network multicast, and each daemon filters it against the subjects its own processes subscribed to. From the Chapter 10 lecture notes

Read the figure as the answer, because a short note on Rendezvous is exactly this:

  • Each machine runs an RV daemon, and each application process links the RV library, which talks to its local daemon.
  • A process publishes on a subject; its daemon multicasts the message on the network.
  • Every daemon receives the multicast and passes it up only to its own processes that subscribed to that subject. Filtering happens at the receiving end, which is why the publisher needs to know nothing at all about who is listening.
  • Subjects are hierarchical dotted names, so a subscription can name a whole subtree with a wildcard.

Its properties: the publisher and the subscribers are referentially decoupled, since neither knows the other; they are temporally coupled, since only currently running subscribers receive the message; adding a subscriber requires no change anywhere; and the load is spread, since there is no central broker to become a bottleneck.

The weakness: because filtering is at the receiver, every machine sees every message on the multicast group, which does not scale across a wide area network. The answer is content based routing, in which subscriptions are pushed into the routers so that they install filters and forward a message only along the paths where somebody wants it.

Asked on the paper, word for word
  • Write short notes on: TIB/Rendezvous 2075 Ashwin Q11b · 3
  • Write short notes on: Rendezvous concept and implementation 2071 Chaitra Q9b · 4

10.5Comparing the case studies

What each one solves, and how they differ PIN 1/22

70 Ch3

The comparison of CORBA and Mach (2070 Chaitra) puzzles students because the two are not alternatives. Say that first, then give the table.

PointCORBAMach
What it isA middleware specification: an object request brokerAn operating system kernel: a microkernel
LayerAbove the operating system, below the applicationBelow the operating system services, above the hardware
Problem solvedHeterogeneity: letting objects in different languages on different machines invoke one anotherStructure: letting operating system services run outside the kernel
Unit of interactionAn object, invoked through an interface defined in IDLA message sent to a port
NamingObject references and the naming servicePort rights held by a task
LanguageNeutral, through IDL and language mappingsC, and it is language independent by being below languages
DistributionBuilt in: the ORB hides the locationAdded by the NetMsgServer, a user level process that forwards messages
OriginObject Management Group, 1989Carnegie Mellon University, 1985
LegacyThe shape of every modern RPC frameworkThe kernel of macOS and iOS

And the other two, side by side:

PointJINITIB/Rendezvous
ModelService federation, with a lookup servicePublish and subscribe, with no broker
AddressingBy interface and attributes, through a proxyBy subject, filtered at the receiver
CouplingReferentially and temporally decoupled through JavaSpacesReferentially decoupled, temporally coupled
Failure handlingLeases that expire unless renewedNothing to clean up, since nothing is registered
LanguageJava onlyLanguage neutral, through the RV library
Typical useDevices joining and leaving a local networkFinancial data feeds, where many readers want the same stream

The one line each, if you have to pick four sentences:

  • CORBA: middleware that lets objects in any language on any machine invoke one another.
  • Mach: a microkernel whose only abstractions are messages to ports and memory objects.
  • JINI: Java services that join and leave a federation by themselves, held together by leases.
  • TIB/Rendezvous: publish and subscribe by subject, with filtering at the receiver.

Notice that all four are answers to chapter 1's challenges: CORBA to heterogeneity, Mach to openness, JINI to failure handling and spontaneity, and Rendezvous to scalability of communication.

Asked on the paper, word for word
  • Write short notes on: Comparison of CORBA and Mach 2070 Chaitra Q11a · 3

10.6Last minute recall

Chapter 10 in one screen

  • CORBA: OMG 1989, a specification not a product. IDL plus language mappings, ORB, object adapter, two repositories, IIOP for interoperability, nine services. Lost to lighter protocols, won the argument.
  • Mach: CMU microkernel. Five abstractions: task, thread, port, message, memory object. Copy on write messaging, external pagers, NetMsgServer for distribution, a BSD server for UNIX compatibility. Became the kernel of macOS.
  • JINI: Sun, Java, federation, spontaneous networking. Components: service, client, lookup service. Protocols: discovery, join, lookup. Terms: federation, leasing, distributed event, group. JavaSpaces gives write, read and take on tuples.
  • TIB/Rendezvous: subject based addressing, publish and subscribe. RV daemon per machine, RV library per process, multicast with filtering at the receiver. Referentially decoupled, temporally coupled. Content based routing for the wide area.
  • Coordination models: direct, mailbox, meeting oriented, generative communication, by temporal and referential coupling.
  • CORBA against Mach: middleware against kernel, object invocation against message to a port, heterogeneity against structure.

96 questions · asked 303 times in 22 papers · exam answers only

Theory answers

Every theory question the 22 papers have set, each with the answer as it is written in the exam: the direct answer for the marks, nothing else. A question with several parts is split into them, and each part is answered on its own. How a device works is in Practical answers and a calculation is in Numerical solutions. The chapter card behind each answer teaches the topic in full. Read them by chapter, each question once with every paper that set it, or by paper, question by question.

1Introduction

Definition of a distributed system TOP 9/22

Asked 9 times

2081 Bhadra · Q12 marksDefine distributed system (DS).

2081 Baishakh · Q12 marksWhat is Distributed System (DS)?

2080 Bhadra · Q12 marksDefine the term "distributed system".

2078 Bhadra · Q12 marksWhat do you mean by Distributed System (DS)?

2076 Chaitra · Q12 marksDefine Distributed System (DS).

2075 Ashwin · Q12 marksDefine distributed system?

2072 Kartik · Q12 marksWhat is Distributed System?

2070 Chaitra · Q12 marksDefine Distributed System,

2070 Ashad · Q12 marksHow do you define Distributed System?

A distributed system is a collection of independent computers at networked locations that communicate and coordinate their actions only by passing messages, and that appears to its users as a single coherent system.

Each computer has its own processor, its own memory and its own clock, so nothing is shared physically; the coordination is entirely in software. It differs from a parallel system, where all processors share one memory, and from a plain computer network, which only carries packets: the service built above the network is what makes it a distributed system.

Design goals of a distributed system HOT 6/22

Asked 6 times

2081 Bhadra · Q10b4 marksWrite short notes on: Goals of DS

2081 Baishakh · Q18 marksWrite the importance and goals of DS.

2080 Baishakh · Q13 marksExplain the design goals

2076 Ashwin · Q14 marksWhat are the major goals of distributed system

2069 Chaitra · Q14 marksWhat are the major goals of distributed system?

2068 Baishakh · Q1b2 marksWhat are goals of distributed system?

The design goals of a distributed system are:

  • Resource sharing. Users must be able to reach remote resources, such as printers, files, databases and services, and share them in a controlled and efficient manner. Sharing lowers cost and enables collaboration, and it makes security a first class concern.
  • Openness. Services are offered through published interfaces with a standard syntax and semantics, specified in an Interface Definition Language. An open system gives interoperability, so independent implementations work together, and portability, so an application runs unchanged on another system with the same interfaces. New components can then be added or replaced without disturbing the rest.
  • Transparency. The separation of components is hidden from the user and the application programmer, so the collection is perceived as one system. Its eight forms are access, location, migration, relocation, replication, concurrency, failure and persistence.
  • Scalability. The system must keep working as it grows in size (more users and resources), in geography (users and resources anywhere) and in administration (many independent administrative domains).

Importance. These goals are what a distributed system is built for: they give higher availability, better price to performance, growth in small steps, and one coherent service over machines that are scattered, independent and unreliable.

Transparency and its forms HOT 6/22

Asked 6 times

2079 Bhadra · Q14 marksTransparency is one of the important design goals of distributed system. Justify it.

2075 Chaitra · Q14 marksExplain the layers of transparency.

2075 Ashwin · Q16 marksExplain Transparency Properties of Distributed System.

2069 Chaitra · Q14 marksExplain the need of transparency in distributed system along with the challenges in achieving that.

2068 Chaitra · Q14 marksExplain distribution transparency in Distributed Systems.

2067 Mangsir · Q17 marksExplain distribution transpareny goal of distributed systems

Transparency is the hiding of the separation of the components of a distributed system from the user and the application programmer, so that the system is perceived as a whole rather than as a collection of independent components. It is needed because the value of a distributed system lies in the single system image: without it the user would have to know which machine holds a resource, whether it has moved, whether it has been copied and whether it has failed.

The eight forms of transparency:

FormHides
AccessDifferences in data representation and how a resource is accessed
LocationWhere a resource is located
MigrationThat a resource may move to another location
RelocationThat a resource may be moved while it is in use
ReplicationThat a resource is replicated, and how many copies exist
ConcurrencyThat a resource is shared by several competing users
FailureThe failure and recovery of a resource
PersistenceWhether a resource is in memory or on disk

The challenge in achieving it. Full transparency is neither always possible nor always desirable. Hiding distribution costs extra messages and extra checks, so it trades against performance and scalability; wide area delays cannot be hidden at all; and pretending a remote operation is local misleads the programmer about its cost and its failure modes. Printing to the nearest printer rather than any printer in the world is a deliberate breach of location transparency that gives the better result.

Design challenges of a distributed system HOT 6/22

Asked 6 times

2080 Baishakh · Q13 marksand challenges in distributed system.

2076 Chaitra · Q18 marksExplain the requirements to successfully implement DS to suit to modern computing.

2076 Ashwin · Q14 marksand what are the challenges during the design of distributed system.

2074 Ashwin · Q16 marksExplain the challenges associated with different requirements of distributed system.

2072 Chaitra · Q16 marksExplain the design issues related to distributed system.

2072 Kartik · Q16 marksDiscuss the challenges of Distribution System with example.

The challenges are the properties a designer must deliver and cannot deliver fully, because each one fights the others.

  • Heterogeneity. Networks, hardware, operating systems, languages and implementations all differ. Middleware and agreed protocols mask the differences. Example: a Java client calling a service written in C on another operating system.
  • Openness. Interfaces must be published and standard so components can be added or replaced. Example: any browser can fetch from any web server because HTTP is public.
  • Security. Confidentiality, integrity and availability must hold over a network an attacker can read, alter, replay and flood. Example: denial of service against a public server.
  • Scalability. Growth in size, geography and administration must not destroy performance or manageability.
  • Failure handling. Failures are partial: some components fail while others continue, and a crash cannot be distinguished from slowness. Failures must be detected, masked, tolerated and recovered from.
  • Concurrency. Shared resources are accessed by many clients at once, so every shared object must keep its data consistent under simultaneous operations.
  • Transparency. Distribution must be hidden, which costs performance and cannot be complete.
  • Quality of service and performance. Responsiveness, throughput and reliability must be maintained, and every one of the challenges above is paid for in messages, that is in time.

Stated the other way, the five design challenges are transparency, scalability, dependability, performance and flexibility: dependability needs consistency, security, concurrency control and fault tolerance together, and flexibility needs extensibility, openness and interoperability, which contradict performance.

Advantages and disadvantages PIN 3/22

Asked 3 times

2079 Bhadra · Q14 marksList out the advantages of distributed system over centralized system.

2073 Shrawan · Q15 marksDiscuss the advantages and disadvantages of DS.

2070 Chaitra · Q16 marksWhat are advantages and disadvantages of distributed system?

Advantages.

  • Economic: a collection of microprocessors gives a better price to performance ratio than one mainframe.
  • Speed: the total computing power exceeds any single machine, and load distribution spreads the work. 10,000 chips at 50 MIPS give 500,000 MIPS, which no single processor can reach.
  • Inherent distribution: some applications are distributed by nature, such as airline reservation and multi branch banking.
  • Reliability: if one machine crashes the system as a whole survives, giving higher availability.
  • Incremental growth: computing power is added in small steps, which is modular expandability.
  • Resource sharing of printers, files and databases among many users.

Disadvantages.

  • Distributed software is difficult to build, which makes the system costlier than others.
  • Exchanging information between components needs coordination, which creates processing overhead.
  • Correctness of algorithms is hard to guarantee when parts of the system are down or recovering.
  • The network becomes a weak point through saturation and lossy transmission, and security is harder because easy access to data is easy access for everyone.

Distributed system compared with a centralized system PIN 3/22

Asked 3 times

2080 Bhadra · Q16 marksIn terms of qualities, advantages and complexities, Compare it with the centralized systems.

2075 Chaitra · Q14 marksWhy distributed system is preferred over centralized system?

2072 Chaitra · Q12 marksDifferentiate between centralized and distributed system?

PointCentralized systemDistributed system
ComponentsOne machine processes, terminals only displayMany independent machines, each able to process
Memory and clockOne memory and one clockPrivate memory and clock per node
FailureA single point of failure: the server fails and all work stopsOne node fails and the rest continue
ScalingReplace with a bigger machine, and there is a ceilingAdd ordinary machines incrementally
CostHigh, mainframe class hardwareLower, many cheap microprocessors
ComplexitySimple to build, secure and debugComplex: coordination, consistency, security and debugging are all hard
DataIn one place and always consistentSpread and replicated, so consistency must be engineered

A distributed system is preferred because it gives better price to performance, higher availability through independent failure, incremental growth, and resource sharing across sites, which a centralized system cannot offer at any price.

Models of a distributed system PIN 3/22

Asked 3 times

2081 Bhadra · Q16 marksBriefly discuss about the models of DS.

2078 Bhadra · Q16 marksExplain various models of Distributed Computing Systems.

2068 Baishakh · Q2a5 marksExplain Distributed computing systems.

A distributed system is described by three kinds of model.

1. Architectural model: what the components are and how they are placed.

  • Client server: a passive server holds a resource and waits, an active client requests and waits for the reply. Used by the web, DNS and NFS.
  • Peer to peer: every node is both client and server with no central authority, scaling well and being harder to manage.
  • Variants: multiple servers, proxy and cache servers, mobile code and mobile agents, and thin or fat clients.

2. Fundamental models: what may be assumed about the components.

  • Interaction model: a synchronous system has known bounds on message delay, execution time and clock drift; an asynchronous system has none.
  • Failure model: omission failures, arbitrary or Byzantine failures, and timing failures.
  • Security model: the threats to processes and to channels, and the protection of objects by access rights.

3. Models of distributed computing systems by the kind of hardware and use: the minicomputer model, the workstation model, the workstation server model, the processor pool model and the hybrid model. In practice the same families appear as cluster computing, which is homogeneous and used for parallel work, grid computing, which is heterogeneous and shared across organisations, and cloud computing, which supplies resources on demand.

Characteristics and properties of a distributed system PIN 2/22

Asked 2 times

2071 Shrawan · Q16 marksDiscuss the properties of Distributed System (DS).

2067 Mangsir · Q13 marksDiscuss the important characteristics of Distributed Systems.

The three defining characteristics of a distributed system are:

  • Concurrency of components. Many programs on many machines execute and share resources at the same time. Concurrency lowers latency and raises throughput, because one unit of work is divided among machines, but it forces the system to control simultaneous access to shared resources.
  • No global clock. Every machine keeps its own clock and no two tick at the same rate, so there is no single correct global time to stamp events with. Coordination is therefore achieved by message passing and by logical ordering rather than by real time.
  • Independent failure of components. Any computer or link may fail while the others continue. The system as a whole survives, since the load of a failed node is taken by others, but no process can tell a crashed node from a slow one, which is called partial failure.

Alongside these, a distributed system shows resource sharing, openness through published interfaces, transparency of distribution, and scalability in size, geography and administration.

A scalable system and the scalability goal PIN 2/22

Asked 2 times

2068 Chaitra · Q14 marksDescribe precisely what is meant by a scalable system.

2068 Baishakh · Q1b3 marksExplain scalability goal in detail.

A system is scalable if it can absorb the addition of users and resources without a noticeable loss of performance and without an increase in administrative complexity. This is Neuman's definition, and it has two halves: performance must hold, and the system must not become harder to manage.

Scalability is measured in three independent dimensions:

  • Size scalability: more users and more resources may be added. It is limited by centralized services, centralized data and centralized algorithms, each of which becomes a bottleneck.
  • Geographical scalability: users and resources may lie far apart. It is limited by communication delay and by the unreliability of wide area links, and by synchronous communication that assumes a fast reply.
  • Administrative scalability: the system spans many independent organisations, each with its own security and management policies, and must still be manageable.

The techniques that buy scalability are hiding communication latency by asynchronous calls, distribution of data and work, for example the DNS hierarchy, and replication and caching, which raise the cost of keeping copies consistent.

The fundamental model PIN 2/22

Asked 2 times

2080 Baishakh · Q12 marksWhat is fundamental model?

2071 Chaitra · Q12 marksWhat is fundamental model?

A fundamental model states the assumptions an algorithm for a distributed system is allowed to make about its components, so that its correctness and its cost can be reasoned about. There are three:

  • Interaction model: how processes communicate and what bounds exist on message delay, on execution speed and on clock drift, which separates synchronous from asynchronous systems.
  • Failure model: the kinds of failure a process or channel may exhibit, namely omission, arbitrary and timing failures, so an algorithm can state what it tolerates.
  • Security model: the threats to processes, to channels and to objects, and the protection used against them.

Architectural styles PIN 2/22

Asked 2 times

2068 Baishakh · Q2b5 marksDefine architectural styles. Describe common architectural styles.

2067 Mangsir · Q22 marksWhat is an architectural style?

An architectural style is the organisation of a system in terms of its components, the way those components are connected, the data exchanged between them, and how these elements are jointly configured.

The common styles:

  • Layered architecture. Components are arranged in layers and a component of layer N may call only layer N minus one, with the reply travelling back up. Protocol stacks are the standard example. It is easy to reason about and adds delay per layer.
  • Object based architecture. Each component is an object and components call each other's methods through a remote procedure call. This matches RMI and CORBA and suits client server systems.
  • Event based architecture. Components publish events and others subscribe to them, so the publisher does not know the receivers. It gives referential decoupling of sender and receiver.
  • Shared data space. Processes communicate by writing tuples into a shared space and reading them out later, which decouples them in time as well as in reference, since sender and receiver need not run together.

Super peers in a decentralized architecture PIN 2/22

Asked 2 times

2068 Baishakh · Q3b5 marksDiscuss super peer in decentralized architecture.

2067 Mangsir · Q24 marksWhat is a super peer, discuss its usage in P2P systems?

A super peer is a node in a peer to peer system that is promoted to hold an index of, and act as a broker for, a set of ordinary peers attached to it. The result is a hybrid architecture: super peers form a peer to peer overlay among themselves, while each ordinary peer has a client server relationship with its super peer.

Usage in peer to peer systems:

  • Searching: a peer sends its query to its super peer, which answers from its index or forwards to other super peers, so the flooding cost of an unstructured network is avoided.
  • Membership and indexing: the super peer keeps track of which of its peers holds what, and of peers joining and leaving.
  • Transfer stays peer to peer: once the holder is known, the data moves directly between the two ordinary peers, so the super peer never becomes a data bottleneck.

Super peers are chosen for capacity and uptime, and a peer that loses its super peer simply attaches to another, so there is no single point of failure as there is in a fully centralized index.

Principle applications and examples PIN 1/22

Asked once

2073 Shrawan · Q13 marksWhat are the principle applications of Distributed System (DS)?

The principle applications of a distributed system are:

  • The internet and the world wide web: documents and services held on millions of servers, assembled into one page for the user.
  • Mobile and cellular networks: coverage divided into cells, each served by its own base stations, handing a call from cell to cell.
  • DNS, a distributed database: the name to address mapping split across a hierarchy of name servers, answering any query as if from one database.
  • Banking and airline reservation: inherently distributed, since a customer deposits at one branch and withdraws at another against the same account.
  • Distributed file systems and cloud storage, where files live on many servers and are reached by one name.

Why the requirements are hard to achieve PIN 1/22

Asked once

2074 Ashwin · Q12 marksWhy there are challenges in achieving some requirements of a distributed system?

Because the requirements conflict with one another and with the physical facts of a network. Transparency, security and dependability are each bought with extra messages, extra copies and extra checks, and every one of those costs performance. Wide area delay cannot be removed, so geographical scalability limits how much distribution can be hidden. Failures are partial and undetectable, so a design can never assume a component is simply present or absent. Achieving one requirement fully therefore weakens another, and a real system settles for a balance.

Pitfalls of a distributed system PIN 1/22

Asked once

2068 Baishakh · Q1a5 marksDiscuss pitfalls of distributed system.

The pitfalls are the false assumptions a developer makes when moving from one machine to many. Each is always wrong, and each breaks the system in a different way.

  • The network is reliable. Messages are lost and links fail, so every remote call needs a timeout and a retry policy.
  • The network is secure. Traffic can be read, altered, replayed and injected, so authentication and encryption are not optional.
  • The network is homogeneous. Machines differ in hardware, byte order, operating system and language, so data must be marshalled into an agreed form.
  • The topology does not change. Nodes join and leave and routes change, so addresses must not be hard coded.
  • Latency is zero. A remote call costs orders of magnitude more than a local one, so chatty interfaces are fatal.
  • Bandwidth is infinite. Large transfers congest links and slow everything sharing them.
  • Transport cost is zero. Marshalling, transmission and unmarshalling all consume processor time and money.
  • There is one administrator. A growing system crosses administrative domains with conflicting policies.

Justifying the single coherent system claim PIN 1/22

Asked once

2071 Chaitra · Q16 marks"Distributed system acts as a single coherent system to its end user." Justify the statement with its features and challenges.

The statement is justified by the way a distributed system presents itself. The user is given one interface, one name for each resource and one answer to each request, while the system decides privately which of its machines serves that request, where the data is held and how many copies of it exist.

The features that produce the coherence:

  • Transparency in its eight forms hides access, location, migration, relocation, replication, concurrency, failure and persistence.
  • Resource sharing through services, so a remote resource is used exactly like a local one.
  • Openness through published interfaces, so components fit together without the user seeing the joins.
  • Concurrency and independent failure are absorbed internally: one node failing is masked by replication rather than shown to the user.

The challenges that limit it: full transparency costs performance and cannot hide wide area delay; partial failure cannot be distinguished from slowness, so failure transparency is never complete; heterogeneity must be masked by middleware; security and concurrency control add further cost. The coherence is therefore an engineered illusion, maintained to the degree the application can afford.

The interaction model PIN 1/22

Asked once

2071 Shrawan · Q12 marksHow interaction model addresses the relevant issues in DS?

The interaction model addresses the two issues that message passing creates: performance of communication and the absence of a global clock.

  • Performance is captured by latency, bandwidth and jitter, which bound what an algorithm can assume about how fast a message arrives.
  • Timing is captured by clock drift rate: local clocks differ, so events cannot be ordered by reading them.

It resolves these by defining two system types. A synchronous distributed system has known upper and lower bounds on message delay, on the time to execute a step and on clock drift, so timeouts are meaningful and failure can be detected. An asynchronous system assumes no bounds at all, which describes the internet, and there ordering must come from logical clocks and agreement cannot be guaranteed in the presence of failure.

How hardware, control and data are distributed PIN 1/22

Asked once

2070 Ashad · Q16 marksExplain with the model, how hardware, data and controls are distributed in the distributed system environment.

Enslow's model answers this. A system counts as distributed only if it is decentralized in all three dimensions at once, drawn as three axes of a cube whose far corner is the allowable region for distributed systems.

Lecture slide: Enslow's model drawn as a three dimensional cube, hardware decentralisation H1 to H5 up the vertical axis, control decentralisation C1 to C6 across, database decentralisation D1 to D6 in depth, with the allowable region for distributed systems marked in the far corner
  • Hardware decentralization, H1 to H5: H1 a single CPU with one control unit; H2 a single CPU with multiple ALUs and one control unit; H3 separate specialized functional units such as a floating point coprocessor; H4 multiprocessors with multiple CPUs but a single I/O system and one global memory; H5 multicomputers with multiple CPUs, multiple I/O systems and local memories.
  • Control decentralization, C1 to C6: C1 a single fixed control point; C2 a single dynamic control point; C3 a fixed master and slave structure; C4 a dynamic master and slave structure modifiable by software; C5 multiple homogeneous control points using copies of the same controller; C6 multiple heterogeneous control points with different controllers.
  • Data or database decentralization, D1 to D6: D1 a centralized database with a single copy of files and directory; D2 distributed files with a single centralized directory and no local directory; D3 a replicated database with a copy of files and directory at each site; D4 a partitioned database with a master keeping a complete duplicate copy; D5 a partitioned database with a master keeping only a complete directory; D6 a partitioned database with no master file or directory.

A system high on the hardware axis alone is only a multicomputer; a system high on all three is a distributed system.

Centralized system architectures PIN 1/22

Asked once

2068 Baishakh · Q3a5 marksExplain different centralized system architectures.

Centralized architectures are the client server family, and they differ in how the three logical parts of an application, the user interface, the processing level and the data level, are divided between machines.

  • Single tier: all three parts on one machine, with terminals attached, which is the mainframe arrangement.
  • Two tier, thin client: the client holds only the user interface and the server does the processing and the data. Cheap clients, heavy server.
  • Two tier, fat client: the client holds the interface and the processing, and the server holds only the data. Light server, heavier client and harder deployment.
  • Three tier: interface, application logic and data each get their own machine, so the middle tier is a server to the front end and a client to the database. This is vertical distribution: different parts on different machines.
  • Horizontal distribution: several identical copies of the same part, with requests divided between them by a front end, which is what actually adds capacity. A replicated web server farm is the example.

Structured peer to peer architecture PIN 1/22

Asked once

2067 Mangsir · Q24 marksDiscuss with one example structured P2P architecture.

In a structured peer to peer architecture the nodes are organised into a fixed, deterministic topology by a distributed hash table, so that any node can find the node responsible for any key without flooding the network.

Example: Chord. Nodes and data items are both hashed into the same m bit identifier space, which is treated as a ring modulo 2m. A key k is stored at its successor, the first node whose identifier is greater than or equal to k. Each node keeps a finger table of m entries, where entry i points to the successor of (n+2i1)mod2m, so a lookup halves the remaining distance at every hop and finishes in O(logN) hops for N nodes. When a node joins or leaves, only the keys between it and its successor move.

The gain is a guaranteed bound on lookup and no central index; the cost is the work of maintaining the finger tables as nodes churn, and the loss of control over where an item is stored.

Peer to peer style of Cassandra PIN 1/22

Asked once

2067 Mangsir · Q8d3 marksP2P style of architecture of Cassandra (just discuss to show the p2p style not the entire architecture)

Cassandra is peer to peer because every node in the cluster is identical: there is no master and no name node, and no node holds a role the others do not.

  • Any node may serve any request. The client contacts any node, which acts as the coordinator for that request and forwards it to the replicas.
  • Placement is by consistent hashing on a ring. The partition key is hashed and the value decides which node owns the row, with the next nodes on the ring holding the replicas, so no directory has to be consulted.
  • Membership is by gossip. Each node exchanges state with a few others every second, so the view of who is alive spreads without a coordinator.
  • Failure is not special. Because no node is unique, a node dying removes capacity but no function, and a new node joins by taking a range of the ring.

Peer to peer style of Cassandra, as a short note PIN 1/22

Asked once

2067 Mangsir · Q8d3 marksExplain any 3 of the following: P2P style of architecture of Cassandra (just discuss to show the p2p style not the entire architecture)

Cassandra is peer to peer because every node in the cluster is identical: there is no master and no name node, and no node holds a role that the others do not.

  • Any node may serve any request. A client contacts any node, which acts as the coordinator for that request and forwards it to the replicas.
  • Placement is by consistent hashing on a ring. The partition key is hashed and the value decides which node owns the row, with the following nodes on the ring holding the replicas, so no directory has to be consulted.
  • Membership is by gossip. Each node exchanges state with a few others every second, so the view of which nodes are alive spreads without a coordinator.
  • Failure is not a special case. Because no node is unique, a node dying removes capacity but no function, and a new node joins simply by taking a range of the ring.

2Distributed objects and file system

Sun NFS: properties, architecture and operation TOP 9/22

Asked 9 times

2081 Bhadra · Q36 marksDiscuss the working principle of any one modern Distributed File System with its architecture.

2081 Baishakh · Q310 marksExplain the principle operation with architecture of recently used distributed file system.

2080 Baishakh · Q35 marksExplain the operation and architecture of any one modern distributed file system.

2076 Chaitra · Q37 marksExplain the principle operations of any one modern distributed file system?

2075 Chaitra · Q36 marksDescribe the architecture and operation of SUNNFS with its services.

2075 Ashwin · Q26 marksExplain Sun Network File System architecture with its features.

2072 Chaitra · Q26 marksDescribe the operations of SUNNFS with its properties.

2071 Shrawan · Q35 marksWhat are the characteristics of SUN-NFS? Discuss with its architecture.

2069 Chaitra · Q35 marksExplain the operation of SUN NFS with its architecture.

Sun NFS is the first commercially successful network file system, developed by Sun Microsystems for diskless workstations, and designed for transparent access, robustness and fast crash recovery.

Properties and characteristics.

  • It is both an implementation and a specification of how to access remote files.
  • It shares a file system in a transparent way.
  • It uses the client server model, and a node can act as both client and server.
  • It uses mount to make a server file system visible from a client.
  • It is stateless: all client requests must be self contained.
  • It is machine and operating system independent.
Lecture note figure: the NFS architecture, application programs making UNIX system calls into the virtual file system of the client kernel, which routes local requests to the UNIX file system and remote requests through the NFS client over the NFS protocol to the NFS server on the server computer

Architecture, in three parts.

  • The protocol. Built on Sun RPC with the XDR external data representation. It is stateless, which makes crash recovery simple, since each procedure call carries all the information needed to complete it.
  • The server side. The server issues a file handle made of the file system identifier, held in the super block and naming the disk partition, the i-node number naming the file, and the generation number held in the i-node, which is incremented on reuse so a stale handle is rejected.
  • The client side. The virtual file system gives a transparent interface, keeping a v-node per open file that records whether it is local or remote, and the mapping from a remote file name to a remote file address is made at boot time by a remote mount.

Operations and services: search for a file within a directory; read a set of directory entries; manipulate links and directories; read and write file attributes; and read and write file data. A mount request returns the file handle of the exported directory, which the client grafts onto its own name space; a hard mount blocks until the server replies, a soft mount returns an error after retries.

Distributed file system: definition, importance and requirements TOP 8/22

Asked 8 times

2079 Bhadra · Q22 marksMention the role of distributed file system.

2076 Chaitra · Q32 marksWhat is distributed file system?

2076 Ashwin · Q33 marksDefine Distributed file system.

2073 Shrawan · Q24 marksWhat are the requirements of Distributed File System?

2072 Chaitra · Q22 marksDiscuss the importance of Distributed File System (DFS).

2072 Kartik · Q32 marksDefine DFS.

2071 Chaitra · Q22 marksDefine DFS.

2070 Ashad · Q32 marksDefine distributed file system.

A distributed file system is a file system distributed across multiple machines, which allows programs to store and access remote files exactly as they do local ones, so that a user can reach the same files from any computer on the network.

Importance and role. It supports the sharing of information in the form of files throughout the intranet; it lets programs use remote files without being rewritten; and it separates storage from the workstation, so one managed and backed up store serves many clients.

Requirements.

  • Transparency of access, location, migration, performance and scaling.
  • Concurrent file updates must be controlled.
  • File replication must be supported, for scalability and fault tolerance.
  • Hardware and operating system heterogeneity: the service interfaces must be implementable on different systems.
  • Fault tolerance: the service must continue to operate through client or server failures.
  • Consistency: files must maintain a consistent state.
  • Security: access control must protect the files.
  • Efficiency: performance comparable with a local file system.

Distributed object, remote interface and IDL HOT 7/22

Asked 7 times

2080 Bhadra · Q22 marksDefine distributed object and IDL.

2079 Bhadra · Q34 marksDefine distributed object and remote interface.

2076 Ashwin · Q23 marksDefine distributed objects

2074 Ashwin · Q23 marksDefine distributed object and IDL.

2072 Kartik · Q24 marksMention the role of IDL and middleware in Distributed System.

2071 Shrawan · Q23 marksWhat is the importance of IDL in RMI?

2069 Chaitra · Q112 marksWhat is IDL?

A distributed object is an object whose instances are distributed across different address spaces, on several computers in a network or on several processes of one computer, and which cooperate by sharing data and invoking one another's methods. They give location transparency, so a remote object and a local object look alike inside a program.

A remote interface is the interface held by a remote object that specifies which of its methods may be invoked by an object in another process. Methods outside it remain private to the object's own process.

An Interface Definition Language (IDL) is a language for specifying a remote interface independently of any programming language. It states the method names, the parameter types, the return values and the exceptions, and it must be complete, giving everything needed to implement the interface, and neutral, not dictating how it is implemented.

Importance of IDL. It is the contract between client and server, so a client written in one language on one machine can invoke a server written in another language on another machine. It lets the client proxy and the server skeleton be generated automatically, it makes interoperability and portability possible, and it allows a component to be replaced by any other that satisfies the same interface. Sun RPC uses XDR, CORBA uses CORBA IDL, and Java RMI uses Java interfaces, which is why Java RMI is limited to Java.

File service architecture HOT 7/22

Asked 7 times

2080 Bhadra · Q34 marksExplain file service architecture for DFS.

2078 Bhadra · Q24 marksDescribe the File Service Architecture of DFS.

2073 Shrawan · Q24 marksDescribe file service architecture for Distributed File System.

2072 Kartik · Q33 marksExplain with the help of suitable architecture.

2070 Chaitra · Q26 marksDraw and explain distributed file service architecture.

2070 Ashad · Q36 marksDraw and explain distributed file service architecture in detail.

2069 Chaitra · Q33 marksWhat do you mean by file and directory service?

The architecture divides a distributed file system into three modules, so that the server modules can be stateless and the responsibilities can be implemented separately.

Lecture note figure: the file service architecture, a client computer holding application programs and the client module, joined across the network to a server computer holding the directory service above the flat file service and its disks
  • Flat file service. Implements operations on the contents of files. Files are identified by a Unique File Identifier (UFID), unique across the whole system, and the service knows nothing of text names. Operations: Read, Write, Create, Delete, GetAttributes, SetAttributes. Read and Write take the position explicitly, which keeps the service stateless.
  • Directory service. Provides the mapping between text names for files and their UFIDs. Operations: Lookup, AddName, UnName, GetNames. Directories are themselves stored as files in the flat file service, so the directory service is a client of it, and a hierarchy is built by directories naming directories.
  • Client module. Runs on each client computer and integrates and extends the two services behind a single application programming interface. It holds the state the stateless server does not, the open files, their positions and the server addresses, and it caches recently used blocks for performance.

RPC compared with RMI HOT 6/22

Asked 6 times

2078 Bhadra · Q24 marksElaborate the differences between RMI and RPC.

2075 Chaitra · Q25 marksComparatively discuss RPC with RMI.

2074 Ashwin · Q25 marksCompare RPC and RMI architecture.

2072 Chaitra · Q32 marksHow RMI is superior to RPC?

2070 Chaitra · Q32 marksDifferentiate between RPC and RMI.

2070 Ashad · Q24 marksDifferentiate between RPC and RMI.

PointRPCRMI
ParadigmProcedural, calls a procedureObject oriented, invokes a method on an object
What is namedA procedure, by program, version and procedure numberAn object, by a remote object reference, then a method
Object referencesNoneRemote object references can be passed and returned
Creating objectsCannot create new instancesCan create remote objects
ParametersOrdinary data, passed by valueObjects, by value or by reference
InterfaceService interface in an IDL such as XDRRemote interface, a Java interface in Java RMI
Client side pieceClient stubProxy
Server side pieceServer stubDispatcher and skeleton
LanguageNeutral through the IDLJava RMI is Java only
Usual semanticsMaybe or at least onceAt most once

Why RMI is superior. It preserves the object model across the network: remote object references can be passed as parameters and returned as results, so a program can build and traverse structures of remote objects, which RPC cannot express. It inherits encapsulation, inheritance and polymorphism, it supports the creation of remote objects and distributed garbage collection, and it provides at most once semantics without the programmer arranging retransmission and duplicate filtering.

Communication between distributed objects HOT 5/22

Asked 5 times

2081 Bhadra · Q23 marksDefine local and remote method invocation in distributed system.

2080 Bhadra · Q42 marksWhat is RMI?

2076 Ashwin · Q25 marksexplain communication between distributed system.

2071 Chaitra · Q26 marksHow RMI perform communication between distributed objects? Explain.

2070 Ashad · Q24 marksExplain the ways how distributed objects communicate with each other.

Remote method invocation (RMI) is the means by which an object in one process invokes a method of an object in another process, on the same computer or a different one. A local method invocation is an invocation between two objects in the same process, which needs only an ordinary reference.

How distributed objects communicate.

  • Only an object that holds a remote object reference for a remote object can invoke it, and only the methods listed in that object's remote interface may be invoked.
  • The invocation is carried by a request reply protocol. The request message holds messageType, requestId, objectReference, methodId and the marshalled arguments; the reply holds the marshalled result.
  • On the client the proxy marshals the arguments and sends the request through the communication module; on the server the dispatcher selects the method and the skeleton unmarshals the arguments, invokes the servant, and marshals the result back.
  • The remote reference module translates between local and remote references at each end, and a binder such as the RMI registry supplies the first remote reference from a textual name.
  • Failures are reported as exceptions, and the call carries one of the three invocation semantics: maybe, at least once, or at most once.

Distributed objects may also communicate by events and notifications, where an object of interest publishes an event and subscribers are notified, which removes the need for the client to ask.

RMI software and its architecture HOT 5/22

Asked 5 times

2079 Bhadra · Q35 marksHow RMI helps in distributed programming model? Explain with architecture.

2076 Chaitra · Q23 marksDiscuss the functionalities provided by RMI software.

2075 Chaitra · Q23 marksWhat do you mean by RMI software?

2072 Chaitra · Q38 marksExplain RMI with suitable diagram.

2072 Kartik · Q26 marksExplain RMI approach in the distributed object based system.

RMI software is the layer between the application objects and the request reply protocol. It consists of three generated classes and two modules.

Lecture slide: the implementation of RMI, object A on the client calling the proxy for B which marshals the arguments and passes them to the communication module and remote reference module, across the network to the server's modules and the skeleton for B, which unmarshals and invokes object B
  • Proxy (client side, one per remote object in use). It implements the same remote interface as the remote object, so the client calls it exactly as if it were the object. Each method marshals the arguments, sends the request, waits, unmarshals the result and returns it.
  • Dispatcher (server side, one per class of remote object). It receives the request, reads the methodId and calls the corresponding method of the skeleton.
  • Skeleton (server side, one per class). It unmarshals the arguments, invokes the method of the servant, then marshals the result and sends the reply.
  • Communication module. Carries out the request reply protocol, matches replies to requests by request id, applies the invocation semantics, and hands an incoming request to the right dispatcher.
  • Remote reference module. Translates between local and remote object references using a remote object table, and creates a proxy when a remote reference first arrives.

Other functionalities provided: a binder such as the RMI registry, which maps textual names to remote object references so a client can obtain its first reference; an activation service, which starts a remote object on demand; distributed garbage collection, which keeps a remote object alive while any proxy refers to it; and persistent object stores for objects that outlive their process.

How this helps the distributed programming model: the programmer writes and calls ordinary methods, and the generated classes and modules hide marshalling, message passing and the locating of the remote object.

Stateful and stateless service HOT 5/22

Asked 5 times

2081 Bhadra · Q32 marksWhat is the difference between stateful and stateless distributed file system?

2080 Baishakh · Q33 marksCompare stasteful and stateless services.

2076 Ashwin · Q35 marksPoint out the differences between stateless and stateful services.

2075 Chaitra · Q32 marksCompare Stateful and stateless service.

2074 Ashwin · Q33 marksWhat is stateful and stateless service in file system?

A stateful service keeps track of information about client requests between calls, such as which files a client has opened, connection identifiers and cached state. A stateless service keeps nothing between calls, so every client request must be self contained, carrying the file name and the offset it needs.

PointStatefulStateless
Request sizeShort: a connection identifier stands for the open fileLonger: the file identifier and offset are repeated every time
PerformanceBetter: the name is parsed once and read ahead is possibleWorse: every request is parsed and located afresh
Server crashState is lost and clients must rebuild itThe client simply retries, since the server held nothing
Client crashThe server must detect it and reclaim memory and locksNothing to reclaim
Memory useGrows with open files and clientsBounded
Operationsopen and close are meaningfulOperations should be idempotent; open and close are not needed
ExampleAFSSun NFS

HDFS and GFS architecture: the single master PIN 3/22

Asked 4 times, in 3 papers

2068 Chaitra · Q38 marksWhy do we have single master in GFS managing millions of chunk servers? What are done to manage it without overloading single master?

2068 Baishakh · Q4a5 marksDiscuss the single master aspect of GFS architecture.

2068 Baishakh · Q4b5 marksEnlist GFS metadata. Why chunk locations not persisted by master, discuss it.

2067 Mangsir · Q310 marksDiscuss assumptions made in GFS design and their consequences. Explain the metadata of GFS?

The design assumptions and what each one bought:

  • Failures are normal, because the cluster is built from commodity machines, so detection and automatic recovery are built in rather than added.
  • Files are huge and few, so a large block or chunk size (64 MB in GFS, 128 MB in HDFS) is chosen, which keeps the metadata small enough to hold in memory.
  • Workloads are large streaming reads and appends, not random writes, so the system optimises sustained bandwidth rather than latency and offers no general update in place.
  • Co-designing the application and the file system is acceptable, so a relaxed consistency model is exposed to the application rather than hidden.
Lecture slide: the HDFS architecture, a single namenode holding the metadata, clients issuing read and write operations, and datanodes holding blocks arranged in two racks with replication between them

The single master. One master, the NameNode, keeps all the metadata and no file data. It maintains the namespace tree, the file to chunk mapping, the access control information, and it instructs the chunk servers or DataNodes to create, delete and replicate blocks. A single master makes placement, re-replication and rebalancing decisions global and simple, and it removes the need for the servers to agree with one another.

The metadata is three things: the file and chunk namespace, the mapping from file to chunks, and the locations of each chunk's replicas. The first two are kept persistent in an operation log or journal and in periodic checkpoints; the third is not.

How it is kept from being overloaded.

  • The master never carries the data. A client asks it for chunk locations and then reads and writes directly with the chunk servers, so the master's traffic is metadata only.
  • Chunks are very large, so a huge file has few chunks and a client needs very few master interactions.
  • Metadata is held in memory, so requests cost no disk access.
  • Clients cache chunk locations for a period, removing repeat queries.
  • Leases are delegated to a primary replica, so the master is not involved in ordering every mutation.

Why chunk locations are not persisted. The master asks each chunk server what it holds at startup, and keeps the map current from periodic block reports. The chunk server is the authority on which chunks are actually on its disks, so persisting the map would only create a second copy that could disagree after a disk failure, a rename or a crash, and would force the master and the servers to be kept in sync. Rebuilding it from reports is simpler and always correct.

Invocation and communication semantics PIN 2/22

Asked 2 times

2081 Bhadra · Q22 markswith its communication semantics.

2071 Shrawan · Q9e4 marksRPC communication semantics

A local call is executed exactly once. A remote call crosses a network, so the request or the reply may be lost and the server may crash, and what the caller is promised depends on three fault tolerance measures: retransmitting the request, filtering duplicate requests at the server, and retransmitting a stored reply instead of re-executing.

SemanticsRetransmit requestDuplicate filteringRe-execute or retransmit reply
MaybeNoNot applicableNot applicable
At least onceYesNoRe-execute procedure
At most onceYesYesRetransmit reply
  • Maybe: the method may be executed once or not at all, and the caller cannot tell which. It suffers omission failure when a message is lost and crash failure when the server fails.
  • At least once: the caller either receives a result, meaning the method ran at least once, or an exception. Retransmission may execute the method more than once, so it is safe only for idempotent operations, and it can suffer arbitrary failure.
  • At most once: the caller either receives the result of exactly one execution or an exception. This is what Java RMI and CORBA provide.

How a DFS encourages sharing of storage PIN 2/22

Asked 2 times

2072 Kartik · Q33 marksHow does DFS encourage sharing a storage device?

2070 Chaitra · Q22 marksHow does that architecture encourage the sharing of storage resources in distributed system? Explain.

The file service architecture separates storage from the machines that use it, and that separation is what makes sharing possible.

  • One store, many clients. The flat file service and directory service run on a server whose disks are the shared storage, while every client runs only a client module, so a single expensive, managed and backed up storage device serves the whole network instead of a disk per workstation.
  • Access and location transparency mean a program opens a remote file with the same call as a local one and does not name the machine, so nothing in the application ties it to one disk.
  • Names are separated from contents. The directory service maps a text name to a UFID, so the same file can be named from several directories and shared by several users without copying it.
  • Concurrency control and access control in the service let several users work on the same storage safely, which is what makes sharing practical rather than merely possible.
  • Replication and caching let the shared store serve many more clients than one disk could, without the users being aware of the copies.

Name services and why naming is necessary PIN 2/22

Asked 2 times

2075 Ashwin · Q22 marksWhy naming is necessary in distributed system?

2073 Shrawan · Q3a1 markWhy naming is necessary in distributed system?

Naming is necessary because every resource a distributed system shares, a file, a printer, a process, a service or a user, must be referred to before it can be used, and the machine level identifiers that actually reach a resource are neither readable nor stable.

  • Resources are accessed through identifiers or references, such as a port number or an object reference, which are efficient but meaningless to a person.
  • A name is a human readable value that can be resolved to an identifier or an address.
  • The binding between a name and the resource can be changed, which is what gives location transparency: a resource may move and its name still works.
  • A name service stores a collection of naming contexts and, given a name, returns the information needed to reach the resource.

HDFS and GFS consistency and high availability PIN 1/22

Asked 2 times, in 1 papers

2068 Baishakh · Q5a5 marksDiscuss consistency guarantees made by GFS.

2068 Baishakh · Q6a5 marksDiscuss GFS high availability.

Consistency guarantees.

  • Namespace mutations are atomic, because the master alone performs them and serialises them with locking and an operation log.
  • A file region is consistent if all clients see the same data whichever replica they read, and defined if it is consistent and a client also sees the whole of what a mutation wrote.
  • A successful serial write leaves the region defined. Concurrent successful writes leave it consistent but undefined, since the region may hold fragments of several mutations. A failed mutation leaves it inconsistent.
  • Record append is guaranteed to append the record atomically at least once at an offset the system chooses, so applications are expected to tolerate padding and duplicates by using checksums and record identifiers.
  • Stale replicas, those that missed a mutation, are detected by their chunk version number and are never given to a client and are garbage collected.

High availability.

  • Fast recovery: the master and the chunk servers are designed to restart in seconds, and there is no distinction between a normal and an abnormal shutdown.
  • Chunk replication, normally three copies placed by rack awareness, so a disk, a machine or a whole rack can fail without loss, and re-replication restores the count automatically.
  • Master replication: the operation log and checkpoints are replicated on several machines, and shadow or backup masters give read only access while the master is down. In HDFS the CheckpointNode merges the journal into a new checkpoint and the BackupNode holds an up to date image ready to take over.
  • Data integrity: every chunk server verifies a checksum per 64 KB block on every read, so a corrupted replica is detected and repaired from another copy rather than returned.

Request reply protocol PIN 1/22

Asked once

2081 Baishakh · Q22 marksWhat do you mean by Request Replay Protocol?

The request reply protocol is the message exchange on which RPC and RMI are built. The client sends a request message identifying the target and the operation together with the marshalled arguments, blocks, and the server sends a reply message carrying the marshalled result.

Its message structure is:

  • messageType: 0 for a request, 1 for a reply.
  • requestId: an integer that matches a reply to its request and identifies duplicates.
  • objectReference: the remote object being invoked.
  • methodId: the method or procedure to run.
  • arguments: an array of bytes holding the marshalled parameters.

It provides three primitives, doOperation at the client, getRequest and sendReply at the server, and it is normally built on UDP, with retransmission, duplicate filtering and reply retransmission added to obtain the required invocation semantics.

Transparency in modern RPC PIN 1/22

Asked once

2070 Chaitra · Q36 marksHow does modern RPC maintain the transparency in distributed system?

Modern RPC maintains transparency by making a remote call look and behave like a local one.

  • Access transparency: the client calls a stub that has the same signature as the real procedure, so the calling code is identical whether the procedure is local or remote.
  • Marshalling is hidden: the stubs convert arguments and results into an external representation, so the programmer never sees byte order or data layout differences.
  • Location transparency: the client finds the server through a binder or port mapper at call time, so no address is written into the program and the server may move.
  • Failure transparency, as far as it can go: retransmission, duplicate filtering and reply retransmission give at most once semantics, so a lost message does not become a wrong result.

Transparency is deliberately incomplete: a remote call is far slower, can fail in ways a local call cannot, and cannot pass pointers, so the interface declares the extra exceptions rather than hiding them.

Parameter passing problems and asynchronous RPC PIN 1/22

Asked once

2067 Mangsir · Q710 marksDiscuss the problems associated with parameter passing in RPC. Explain with diagram different alternatives of asynchronous RPC.

Problems with parameter passing.

  • Pointers and references cannot be passed: the client and server have separate address spaces, so an address is meaningless at the other end. The usual solution is copy in, copy out, in which the referenced value is flattened and sent.
  • Complex and linked structures such as trees and graphs must be serialised into a flat form and rebuilt, which is expensive and must handle cycles.
  • Machine differences: byte order, word size, floating point format and character encoding differ, so an agreed external data representation such as XDR is needed, with marshalling and unmarshalling at each end.
  • Call by reference semantics are lost: updates made by the server to a copied parameter are only seen if the value is copied back, so the semantics differ from a local call.
  • Global variables and side effects are not shared between the two address spaces.

Alternatives of asynchronous RPC. Ordinary RPC blocks the client until the reply arrives, which wastes time when the result is not needed at once.

  • Asynchronous RPC: the server sends an immediate acceptance acknowledgement and the client continues; the result is delivered later. Used when the caller needs the work done but not the answer straight away.
  • One way or deferred synchronous RPC: two asynchronous calls are combined, the client issues the call and the server calls the client back with the result when it is ready.
  • Multicast RPC: one request is sent to a group of servers, and the client collects replies from all of them or from the first to answer.

Event and notification system PIN 1/22

Asked once

2076 Chaitra · Q25 marksHow is the event and notification system implemented in distributed object based communication?

In an event and notification system an object publishes the events it experiences and other objects subscribe to the kinds of event that interest them, so the publisher does not know its receivers and neither side blocks on the other.

Participants.

  • Object of interest: the object whose change of state causes an event.
  • Event: the occurrence, with the attributes that describe it.
  • Notification: the object that carries the event to a subscriber.
  • Subscriber: an object that has registered interest in a class of events.
  • Observer or event service: the intermediary that decouples publishers from subscribers.
  • Publisher: the object that sends the notification.

Implementation. Subscribers register with the event service, giving the type of event and any attribute filter. When an object of interest changes state it sends a notification to the event service, which matches it against the registered interests and forwards it to each matching subscriber, queueing for those that are unavailable. Observers may be interposed to forward, filter, store or pattern match notifications on a subscriber's behalf.

The model gives heterogeneity, since publisher and subscriber share only the event format, and asynchrony, since notifications are sent without the publisher waiting. The Jini distributed event specification is the standard implementation.

Design issues on NFS PIN 1/22

Asked once

2078 Bhadra · Q44 marksWhat are the design issues on NFS?

  • Statelessness against UNIX semantics. Because the server keeps no state, every request must carry the file handle and the offset, and open and close semantics have to be emulated by the client, so full one copy UNIX semantics cannot be reproduced.
  • Caching and consistency. Client caching is necessary for performance but creates stale data. NFS validates a cached block against the file's modification time on a timer, which is only an approximation of consistency.
  • Locking. Concurrency control is not part of the stateless protocol, so a separate and stateful lock manager is required.
  • Security. The user identity is carried in the RPC credentials, which the server must trust, so NFS needs a trusted network or Kerberos style authentication.
  • Performance. Writes must reach the server's disk before it replies, since the server may hold nothing between calls, which makes writes expensive.
  • Replication. Only read only replication is supported, so the file server remains a single point of failure for writes.
  • Name space. Mount points are set per client, so the name space is not automatically identical on every machine.

Advantages and consequences of statelessness PIN 1/22

Asked once

2080 Bhadra · Q10c4 marksAdvantages and consequences of statelessness in DFS

Advantages.

  • Fast crash recovery. A restarted server needs no recovery protocol and no state to rebuild, and a client cannot distinguish a slow server from a restarted one, so it simply retries.
  • No client crash handling. The server holds nothing on a client's behalf, so a dead client costs nothing.
  • Bounded memory and a simpler server, since the server keeps no per client table.
  • No limit on open files and no open or close operations needed in the protocol.

Consequences.

  • Longer request messages, because every request repeats the file handle and the offset.
  • Lower performance, since the server cannot parse the name once or read ahead on the basis of retained state.
  • Operations must be idempotent, so that retransmission is safe.
  • No server side locking or open file consistency, so a separate and stateful lock manager is needed.
  • Writes must be committed to disk before the reply, because nothing may be held in the server's memory.

Recursive and iterative queries PIN 1/22

Asked once

2079 Bhadra · Q22 marksWhat is recursive and iterative query?

A query is a request for name resolution directed to a DNS server.

  • A recursive query requires a complete answer: the server that receives it must resolve the name fully, asking other servers on the client's behalf, and return either the answer or a failure. Clients normally send recursive queries to their local server.
  • An iterative query may be answered with a referral to another DNS server that is closer to the answer, leaving the asking server to continue the search itself. Root and top level domain servers answer only iteratively, which is how they survive their load.

Root hints hold the addresses of the root servers, which is where an iterative search begins.

DNS working with the role of the file system PIN 1/22

Asked once

2079 Bhadra · Q23 marksDescribe working mechanism of DNS with suitable example.

A resolver asks its local DNS server for the address of a name. If the local server has the answer cached it replies at once. Otherwise it queries a root server, which refers it to the top level domain server; that server refers it to the authoritative server for the domain; and the authoritative server returns the A record. The local server caches the answer for its time to live and returns it to the client.

Example. For www.ioe.edu.np the local server asks a root server, which refers it to the servers for np; those refer it to the servers for edu.np; those refer it to the authoritative servers for ioe.edu.np, which return the address. The browser then opens a connection to that address.

NoSQL and normalization in analytics PIN 1/22

Asked once

2068 Chaitra · Q78 marksExplain term 'NoSQL'. Why does normalization fail in data analytics scenario?

NoSQL names a family of data stores that abandon the relational model and the fixed schema in favour of simpler structures that can be spread across many machines. The main kinds are key value stores, document stores, column family stores and graph stores. Their common properties are a flexible or absent schema, horizontal scaling by adding commodity machines, partitioning and replication built in, and relaxed, usually eventual, consistency in place of full ACID transactions. The price is that joins and multi row transactions are not provided, so the application must do that work itself.

Why normalization fails in a data analytics scenario.

  • Normalization is designed for updates, not for scans. It splits data into many small tables so that a fact is stored once and an update touches one place, which is right for transaction processing where writes are frequent and each query touches few rows.
  • Analytics does the opposite: it reads enormous numbers of rows and almost never updates them, so the benefit of storing a fact once is never collected.
  • Every join becomes a shuffle. On a cluster the tables are partitioned across machines, so joining them moves terabytes across the network, which is far more expensive than the computation itself.
  • Denormalized, redundant records let each record be read once, in one place, by the machine that already holds it, which is exactly what MapReduce is built to do.
  • Storage is cheap and bandwidth is not, so duplicating data to avoid a join is the correct trade in an analytics system and the wrong one in a transaction system.

Inverted index through MapReduce PIN 1/22

Asked once

2068 Baishakh · Q8a4 marksWrite pseudo code for inverted index (term vector per host) generation through mapreduce.

The job takes the crawled documents and produces, for each term, the list of hosts that contain it together with the count on each host.

Mapper. The input is one document, keyed by its URL.

map(key = url, value = document_text):
          host = extract_host(url)
          counts = empty map
          for each term t in tokenize(document_text):
              counts[t] = counts[t] + 1
          for each (t, c) in counts:
              emit(key = t, value = (host, c))

Counting inside the mapper before emitting is what makes it a term vector per host rather than one record per word occurrence.

Combiner, which is the same code as the reducer and is valid because addition is associative and commutative:

combine(key = t, values = list of (host, c)):
          totals = empty map
          for each (host, c) in values:
              totals[host] = totals[host] + c
          for each (host, c) in totals:
              emit(key = t, value = (host, c))

Partitioner: hash(t) mod R, so every occurrence of a term reaches the same reducer.

Reducer. The framework has grouped and sorted by term, so the reducer sees each term once with all its host counts.

reduce(key = t, values = list of (host, c)):
          totals = empty map
          for each (host, c) in values:
              totals[host] = totals[host] + c
          posting = sort totals by count descending
          emit(key = t, value = posting)

Key and value types: map input is (Text url, Text document); the intermediate pair is (Text term, HostCountWritable); the reduce output is (Text term, Text posting_list).

Average score per student through MapReduce PIN 1/22

Asked once

2067 Mangsir · Q610 marksYou are given student records consisting of following fields in each record: rollno(integer), department id (integer), name (string), subject code(integer), score on the subject (double). You can assume the delimiter of the fields as space. It is required to calculate the agerage value of score for a student and present the average score and total score along with name, department and rollno of the student in the output records. The order of the output be according to rollno, and if the same rollno appear in two departments then by rollno+department. (Note here that the rollno and department id are integers not strings). Write a complete code for mapper, reducer, combiner(if any), partitioner(if any) in Java language on Hadoop platform. You can ommit the job submission and imports part. Clearly specify the key/value data types in each phase. OR Write a complete pseudocode for mapper, reducer, partitioner(if any), combiner(if any) along with clear explanation of the key/value types in each phase.

Each input line is rollno department_id name subject_code score, separated by spaces. The output must carry the name, department and roll number with the total and average score, ordered by roll number and, where a roll number appears in two departments, by roll number then department.

The composite key is the whole design. Because the output must be sorted by roll number and then department, the key is the pair (rollno, department_id) as a WritableComparable whose compareTo compares the roll number first and the department second, both as integers so that 10 sorts after 9.

Mapper.

map(key = byte_offset, value = line):
          fields = split(line, " ")
          rollno  = toInt(fields[0]);  dept = toInt(fields[1])
          name    = fields[2];         score = toDouble(fields[4])
          emit(key = StudentKey(rollno, dept),
               value = Partial(name, sum = score, count = 1))

Combiner, valid because summing scores and counts is associative and commutative:

combine(key = StudentKey, values = list of Partial):
          sum = 0; count = 0; name = ""
          for each p in values:
              sum = sum + p.sum;  count = count + p.count;  name = p.name
          emit(key, Partial(name, sum, count))

Partitioner. A record must reach one reducer per student, so partition on the roll number alone and let the sort order do the rest:

getPartition(key = StudentKey, value, numReducers):
          return (key.rollno & MAXINT) mod numReducers

Reducer.

reduce(key = StudentKey, values = list of Partial):
          sum = 0; count = 0; name = ""
          for each p in values:
              sum = sum + p.sum;  count = count + p.count;  name = p.name
          average = sum / count
          emit(key = NullWritable,
               value = name + " " + key.dept + " " + key.rollno
                            + " " + sum + " " + average)

Key and value types in each phase.

PhaseKeyValue
Map inputLongWritable, the byte offsetText, the whole line
Map output and combinerStudentKey, a WritableComparable of two IntWritable fieldsPartial, a Writable of name, sum and count
Reduce inputStudentKeyIterable of Partial
Reduce outputNullWritableText, the formatted record

Why the ordering works. Within one reducer the framework sorts by the composite key, which compares the roll number and then the department, so the output of each reducer is already in the required order. Using a single reducer gives one globally ordered file; using several requires a total order partitioner so that each reducer takes a contiguous range of roll numbers.

3Operating system support

Monolithic kernel and microkernel HOT 5/22

Asked 5 times

2079 Bhadra · Q9d3 marksWrite short notes on: Monolithic and micro kernel

2076 Ashwin · Q10b4 marksWrite short notes on any two: Monolithic and micro kernel

2075 Ashwin · Q44 marksBriefly explain the Monolithic and microkernel architectures of operation system.

2072 Kartik · Q9d3 marksWrite short notes on: Monolithic and Microkernel

2071 Shrawan · Q9a4 marksWrite short notes on (Any Three): Monolithic and Micro-Kernel

A monolithic kernel is a single large process running in a single address space, in which all kernel services execute in kernel space. A microkernel is a kernel broken into separate processes called servers, which run in kernel space and in user space, leaving only the minimum in the kernel.

Textbook figure: a monolithic kernel drawn as one wide block containing all the server code, beside a microkernel drawn as a narrow block with the servers S1 to S4 as separate dynamically loaded processes above it
PointMonolithic kernelMicrokernel
StructureOne large process in one address spaceA small kernel with separate server processes
Execution speedFaster: no address space switch is needed for a kernel serviceSlower: a service call becomes a message between processes
Device driversReside in kernel space, which makes it less secureReside in user space
Effect of a faultA fault in one kernel service collapses the whole kernelA fault in one server does not collapse the kernel
Adding a featureRequires recompiling the whole kernelLoad another server, leaving the kernel untouched
SizeLarge, and harder to portSmall, and easier to port
ExamplesKernels of UNIX and LinuxKernels of Mac OS X and Windows NT, and Mach

Process and thread compared HOT 4/22

Asked 4 times

2079 Bhadra · Q9a3 marksWrite short notes on: Process and threads in a DS

2072 Kartik · Q44 marksHow threads differ from process?

2070 Chaitra · Q42 marksCompare process and threads.

2070 Ashad · Q11a4 marksWrite short notes on: Process and threads in OS

A process is an instance of a program in execution, consisting of an execution environment, that is an address space, communication interfaces and synchronisation resources, together with one or more threads. A thread is a lightweight process that shares the address space of its process but runs in quasi parallel with the other threads; it is the operating system's abstraction of an activity.

PointProcessThread
MemoryRuns in its own separate memory spaceThreads of a process share one memory space
IndependenceA self contained entityDepends on its process for existence
ResourcesDepends heavily on resourcesRequires a minimal amount
CommunicationMust use inter process communicationCommunicates easily through shared variables
OverheadConsiderable for creation and switchingVery small: creation about 10 to 20 times cheaper
ProtectionProtected from other processesNot protected from other threads of the same process

Network operating system and distributed operating system PIN 3/22

Asked 3 times

2078 Bhadra · Q3a4 marksWhat are the key differences between Network OS and Distributed OS.

2075 Ashwin · Q42 marksWhat do you mean by DOS (Distributed Operating System)?

2072 Chaitra · Q9a4 marksWrite short notes on: Distributed OS

A network operating system has networking capability and can be used to reach remote resources, but each node keeps its own system image and a user must explicitly log in to another computer to run processes there. A distributed operating system produces a single system image for all the resources of the system: users are never concerned with where their programs run, and the operating system controls all the nodes.

PointNetwork OSDistributed OS
Also calledThe dialogueThe middleware
System imageOne per node, so the user sees many machinesA single image, so the user sees one machine
CouplingLoosely coupledTightly coupled
Built forHeterogeneous multicomputers on a LAN or WANMultiprocessors and homogeneous multicomputers
Main goalOffer local services to remote clientsHide and manage the hardware resources
Where work runsOn the server the client contacted; the client only relays input and outputWherever the system schedules it, balancing load
Heavy computationHandled badly, because it stresses one serverShared out so each computer carries an equal load
Client resourcesEnough to boot and contact the serverRelatively little needed on the user terminal

Why NOS is preferred in practice, and DOS as middleware PIN 2/22

Asked 3 times, in 2 papers

2070 Chaitra · Q54 marksHow is distributed operating system realized in practical distributed systems? Explain.

2069 Chaitra · Q44 marksWhy network operating system (NOS) is widely preferred over distributed operating system (DOS) in practical distributed systems?

2069 Chaitra · Q44 marksExplain DOS as a middleware.

Why NOS is preferred.

  • Existing applications. Users invest in applications that meet their current problem solving needs, and will not move to an operating system that cannot run them, however efficient it is.
  • Autonomy. Users want a degree of control over their own machines even in a closely knit organisation, because they do not want their own work slowed by processes scheduled onto their machine by somebody else.
  • Heterogeneity. A real network holds many kinds of machine and operating system, which a distributed operating system cannot span.
  • Scale and failure. A single operating system controlling every node does not scale to a wide area and creates a common point of failure.

DOS as middleware, which is how it is actually realised. Instead of replacing each machine's operating system, the distribution is provided by an additional layer on top of the network operating systems, and that layer is the middleware. It offers general purpose services above the local operating systems: remote invocation through RPC or RMI, naming, a distributed file service, time and clock services, security, transactions and load management. Each node keeps its own operating system and its owner keeps autonomy, while the middleware supplies the distribution transparency that a distributed operating system was supposed to give. This is why the comparison table calls a distributed operating system "the middleware", and why every real system, from NFS to CORBA, is built this way.

Importance of threads and multithreading in a distributed system PIN 2/22

Asked 2 times

2080 Baishakh · Q9c4 marksWrite short notes on: Multithreading in DS

2070 Chaitra · Q42 marksWhy threads are important in distributed System.

Multithreading is the use of several threads of control within one process, sharing its address space and resources. It is what makes a distributed system practical.

  • Concurrency for multiple users. A distributed system must support many users at once, which is impossible without multithreaded support in a server.
  • A thread can block on a system call without blocking the whole process. A remote invocation takes milliseconds, and while one thread waits the others continue, so a server can maintain many logical connections at the same time.
  • Parallelism. Threads of a single process can run in parallel on different processors of a multiprocessor.
  • Easy sharing. Threads share a common buffer, so patterns such as producer and consumer, and caching inside a server, are simple to implement.
  • Cheapness. Creating a thread is 10 to 20 times cheaper than creating a process, and switching between threads of one process is 5 to 50 times cheaper than switching processes.

Server threading architectures are thread per request, thread per connection, thread per object and the worker pool.

Advantages of the microkernel and which kernel suits a distributed OS PIN 1/22

Asked 2 times, in 1 papers

2073 Shrawan · Q3b2 marksWhat are the advantages of micro-kernel over monolithic-kernel?

2073 Shrawan · Q3b3 marksIn your view, which kernel is preferable for distributed Operating system and why?

Advantages of a microkernel over a monolithic kernel.

  • Fault containment: a failed server does not bring the kernel down, and it can be restarted.
  • Extensibility: a new service is added as another server, without recompiling or rebooting the kernel.
  • Security: device drivers and services run in user space, so far less code holds full privilege.
  • Portability and size: the kernel is small and hardware dependent code is minimal.
  • Flexibility: different, even competing, versions of a service may run at the same time.

The microkernel is preferable for a distributed operating system, for three reasons.

  • The services of a distributed system are complex, and the microkernel's separation of them into independent servers makes that complexity manageable.
  • It provides faster communication among processes with low overhead, which a distributed system performs constantly.
  • A service can be added, replaced or even placed on a different machine without changing the kernel, which is what an evolving distributed system requires.

The practical answer is a hybrid: a microkernel structure with performance critical servers moved back into kernel space, which is what Windows NT and macOS do.

Operating system support for a distributed system PIN 1/22

Asked once

2071 Chaitra · Q52 marksHow does operating system support for distributed system?

The operating system layer sits between the hardware and the middleware, and supports a distributed system by providing the abstractions the middleware needs for remote invocation.

  • Encapsulation: it offers each physical resource as a useful service with a clean interface, hiding its representation.
  • Protection: it shields resources from illegitimate access, by running user processes in user mode within private address spaces and allowing entry only through system call traps.
  • Concurrent processing: it lets several clients share a resource transparently, through processes and threads.
  • Communication: it passes operation arguments and results between threads of different processes, locally or across the network.
  • Process and thread management: creation, scheduling and synchronisation, so a server can serve many clients at once.
  • Memory management and the supervisor, which dispatch interrupts and system call traps and manage the address spaces.

The five core components that deliver this are the process manager, the thread manager, the communication manager, the memory manager and the supervisor.

Characteristics of a distributed operating system PIN 1/22

Asked once

2074 Ashwin · Q44 marksWhat are the characteristics of distributed operating system?

  • Single system image: all the resources of all the nodes appear as those of one machine.
  • Transparency: access, location, migration and replication of resources are hidden from the user.
  • Global resource management: the operating system controls every node and schedules work across them, balancing load between busy and idle machines.
  • Process migration: a process may be moved to another node for load sharing or to be nearer its data.
  • Data migration and computation migration: either the data is transferred, as a whole file or only the parts needed, or the computation is moved to the data.
  • A global file system and a global name space, so a name means the same thing everywhere.
  • Inter process communication across nodes as the basic mechanism, since there is no shared memory.
  • Fault tolerance: the failure of a node degrades the system rather than stopping it.
  • Tight coupling and homogeneity: it is normally built for multiprocessors and homogeneous multicomputers.

4Heterogeneity and CORBA

CORBA services TOP 9/22

Asked 9 times

2080 Bhadra · Q42 marksalong with services.

2080 Baishakh · Q9d4 marksWrite short notes on: CORBA services

2075 Chaitra · Q42 marksand its services.

2072 Chaitra · Q44 marksand its services.

2072 Kartik · Q9c3 marksWrite short notes on: CORBA services

2071 Chaitra · Q52 marksWhat are CORBA services?

2071 Shrawan · Q9b2 marksWrite short notes on (Any Three): Services provided by CORBA

2070 Ashad · Q102 marksWrite different services provided by CORBA.

2069 Chaitra · Q112 markswith its services.

  • Naming service. Object references can be stored with associated names and properties, and the naming service lets clients find objects by name.
  • Trading service. Lets clients find objects by their properties rather than by name.
  • Transaction management service. Provides two phase commit coordination among recoverable components that use transactions.
  • Concurrency control service. Provides a lock manager that obtains and frees locks for transactions or threads.
  • Security service. Protects components from unauthorised users, providing authentication, access control lists and confidentiality.
  • Time service. Provides interfaces for synchronising time and operations for defining and managing time triggered events.
  • Event service. Decouples suppliers of events from consumers, delivering notifications without the supplier knowing the receivers.
  • Persistence service and life cycle service. Store an object's state beyond the life of its process, and create, copy, move and delete objects.

These and others are specified by the CORBA documents, and current products implement only some of them.

CORBA architecture and its components TOP 8/22

Asked 8 times

2080 Bhadra · Q44 marksExplain CORBA architecture in Distributed System

2078 Bhadra · Q10c4 marksWrite short notes on: CORBA Architecture

2076 Chaitra · Q9b3 marksWrite short notes on: CORBA component for RMI

2076 Ashwin · Q48 marksExplain components in CORBA architecture with a diagram.

2075 Chaitra · Q43 marksExplain the CORBA architecture

2073 Shrawan · Q4a4 marksWhat are the components of CORBA environment?

2072 Chaitra · Q44 marksExplain about CORBA

2069 Chaitra · Q112 marksExplain CORBA RMI

CORBA, the Common Object Request Broker Architecture, is the Object Management Group's specification of the middleware that lets application objects communicate with one another whatever their location, designer or implementation language. OMG provides the specification; several products implement it.

Lecture slide: the components of a CORBA environment, two client applications reaching the object request broker through the dynamic invocation interface and a static proxy, an interface repository beside them, and on the server side the object adapter, the server skeleton and the implementation repository
  • Client application: the object making the request.
  • Proxy (static): the client stub generated from the IDL, used when the interface is known at compile time. It marshals the arguments and passes the request to the ORB.
  • Dynamic invocation interface: the alternative path, which builds the request at run time after consulting the interface repository.
  • Interface repository: holds a standard representation of the available object interfaces, corresponding to the servers' IDL specifications, so a client can discover what operations exist and what parameters they take.
  • Object Request Broker (ORB): the bus that locates the target object, transmits the request and returns the result, hiding the location and the implementation.
  • Object adapter: the primary interface between the server object implementation and the ORB. It registers objects, generates object references, dispatches incoming requests, and activates servers and objects.
  • Server skeleton: generated from the IDL, it unmarshals the arguments and invokes the method on the server object.
  • Implementation repository: holds the implementation details, mainly the mapping from a server object's name to the file that implements it, and is used by the object adapter to activate the right method.
  • Server object: the object that performs the operation.

CORBA as RMI. The components map one for one onto the RMI software: the CORBA proxy is the RMI proxy, the CORBA skeleton is the RMI skeleton, and the communication module and remote reference module are inside the ORB. What CORBA adds is language neutrality through CORBA IDL, the object adapter, and the two repositories.

Middleware and its role in a distributed system HOT 5/22

Asked 5 times

2080 Baishakh · Q22 marksExplain the role of middleware in Distributed System.

2078 Bhadra · Q3b4 marksExplain the various roles of middleware in DS.

2072 Chaitra · Q42 marksWhat is the role of middleware in DS?

2072 Kartik · Q22 marksmiddleware in Distributed System.

2069 Chaitra · Q23 marksHow do you convince that middleware plays the important role in Distributed System?

Middleware is a software layer situated between the applications and the operating systems, made of services that let applications and users interact across a heterogeneous distributed system. It resides above the network and below the application software.

Its roles.

  • Hides the intricacies of distributed applications, so the programmer writes an ordinary call instead of a protocol.
  • Hides the heterogeneity of hardware, operating systems and protocols.
  • Provides uniform and high level interfaces, which makes applications interoperable, reusable and portable.
  • Handles communication between components, making no assumption about the content beyond that the receiver can understand it.
  • Provides common services so that each application need not reimplement naming, security, transactions and persistence, which removes duplicated effort.
  • Performs load management, starting and stopping services and directing load to them.
  • Provides authentication and authorisation, audit and logging.
  • Provides interoperability between applications running on different operating systems.

An operating system gives an API for using the underlying hardware; middleware gives an API for using the underlying operating system. Without it, every application would have to be written for a particular pair of machines, which is the argument for its importance.

Heterogeneity in distributed systems HOT 4/22

Asked 4 times

2075 Chaitra · Q43 marksCompare heterogeneous and homogeneous distributed system.

2071 Chaitra · Q9a4 marksWrite short notes on: Heterogeneity in distributed system

2070 Chaitra · Q52 marksGive an example of heterogeneous model of distributed application.

2070 Ashad · Q44 marksDifferentiate between homogeneous and heterogeneous distributed applications with example.

Heterogeneity means that the parts of a distributed system differ from one another, and a distributed application is typically heterogeneous in four ways:

  • Different hardware: mainframes, workstations, personal computers, servers.
  • Different software: UNIX, MS Windows, OS/2, real time operating systems.
  • Unconventional devices: teller machines, telephone switches, robots, manufacturing systems.
  • Diverse networks and protocols: Ethernet, FDDI, ATM, TCP/IP, NetWare.

It arises because different hardware and software are optimal for different parts of the system, because the users who must interact choose different vendors, and because legacy systems must be kept.

PointHomogeneousHeterogeneous
Hardware and OSSame throughoutDifferent on different nodes
Data representationIdentical, so no conversionDiffers, so marshalling into a common form is required
MiddlewareBarely neededEssential, to mask the differences
ManagementSimple, one administrationComplex, often several administrations
ExampleA cluster of identical servers running one parallel programA grid, or a bank in which teller machines, branch servers and a mainframe cooperate

Example of a heterogeneous distributed application: an airline reservation system in which booking counters on personal computers running Windows, web servers on Linux, and a mainframe holding the reservation database all take part in a single booking transaction. Heterogeneity is masked by middleware, by an agreed external data representation, and by interfaces published in an IDL.

Static and dynamic invocation in CORBA PIN 3/22

Asked 3 times

2081 Bhadra · Q10d4 marksWrite short notes on: CORBA dynamic invocation

2075 Ashwin · Q54 marksExplain the invocation methods in CORBA.

2070 Ashad · Q104 marksWhat are dynamic and static invocation approaches of CORBA.

CORBA allows both, and the choice depends on how much is known about the server object at compile time.

Static invocation. It is based on compile time knowledge of the server's interface specification. The specification is written in IDL and compiled into a proxy, the client stub, in the client's programming language. For the client the invocation looks like a local call to a proxy method, and it is forwarded automatically through the ORB, the object adapter and the skeleton. It has low run time overhead and is checked by the compiler.

Dynamic invocation. It allows a client to invoke requests on an object without compile time knowledge of its interface.

  1. The client obtains the object reference from the naming service.
  2. It inspects the interface repository to discover the object's methods, parameters and types at run time.
  3. Through the dynamic invocation interface it constructs the request and supplies argument values matching the server's interface.
  4. It issues the request, which then has the same effect as a static invocation.

Its execution overhead is very large compared with a static call. From the server's point of view the two are identical: the server does not know how it was invoked, because the invocation always arrives through its skeleton, generated at compile time from the IDL. Where the server itself does not know the interface at compile time, the dynamic skeleton interface is used.

The ORB and its interfaces PIN 2/22

Asked 2 times

2079 Bhadra · Q9b3 marksWrite short notes on: ORB and its interfaces

2074 Ashwin · Q44 marksExplain ORB and its interfaces.

The Object Request Broker is the middleware bus that provides the mechanisms by which objects transparently interact with each other: it finds the target object, transmits the request, activates the object if necessary and returns the result.

Lecture slide: the ORB and its interfaces, with shading showing which parts are implementation dependent, which are identical for every ORB implementation, and which are the proxies and skeletons generated per server interface

Its interfaces.

  • The proxies, or client stubs, one per server interface, generated from the IDL. A static invocation is issued through them.
  • The dynamic invocation interface, through which a request is constructed at run time from the interface repository.
  • The server skeletons, one per server interface, through which the specific server method is invoked after the object adapter forwards the request.
  • The object adapter interface, between the server object implementation and the ORB.
  • The ORB interface itself, which clients and object implementations may use directly for certain services: directory services, services connected with naming, and the manipulation of object references.

Some of these interfaces are identical for all ORB implementations, which is what makes client code portable between products, while others are implementation dependent, and the proxies and skeletons are generated separately for each server interface.

The object adapter and its functions PIN 2/22

Asked 2 times

2075 Ashwin · Q52 marksDefine Object Adapter.

2071 Shrawan · Q9b2 markswith the functions of Object Adapter

The object adapter is the primary interface between the server object implementation and the ORB. It hides from the ORB how an object is implemented, and hides from the object how the ORB delivers a request.

Services it provides.

  • Object registration: operations by which entities written in a given programming language are registered as CORBA objects.
  • Object reference generation: it generates the object references that identify those CORBA objects.
  • Object upcalls: it dispatches incoming requests to the corresponding registered objects, through their skeletons.
  • Server process and object activation: where needed it starts server processes and activates objects in response to an incoming invocation, using the implementation repository.

The original was the Basic Object Adapter; OMG later standardised the Portable Object Adapter, which makes server code portable between ORB products.

5Time and state

Physical and logical clocks HOT 6/22

Asked 6 times

2081 Baishakh · Q42 marksWhat is the difference between physical and logical clock?

2080 Baishakh · Q42 marksWhat is physical and logical clock?

2072 Chaitra · Q52 marksDifferentiate between physical clock and logical clock.

2070 Chaitra · Q62 marksWhat do you mean physical and logical clocks?

2070 Ashad · Q52 marksCompare physical clocks and logical clocks with its implementation semantics.

2069 Chaitra · Q52 marksDefine logical and physical clocks.

A physical clock is the electronic device in each computer that counts the oscillations of a crystal at a definite frequency and stores the count divided by the frequency in a register, giving the time of day. A logical clock is a monotonically increasing software counter that records the relative ordering of events in a process, and makes no claim to be a time of day.

PointPhysical clockLogical clock
ValueReal time, kept close to UTCA counter, with no relation to real time
PurposeTo say at what time of day an event occurredTo say in what order events occurred
SynchronisationNeeded constantly, because crystals driftNot needed; the rules are enough
ImplementationCristian's method, Berkeley's algorithm, NTPLamport's clock and vector clocks
SemanticsTimestamps comparable across machines only within an accuracy boundTimestamps respect causality exactly
CostMessages, and accuracy limited by delayOne counter, and a field on each message

Limitations of Lamport's clock HOT 6/22

Asked 6 times

2081 Bhadra · Q44 marksproposed the approach to avoid issues with Lamport's clock.

2078 Bhadra · Q52 marksState the limitations of Lamport logical clock.

2076 Chaitra · Q42 marksWhat is the issue in Lamport's timestamp?

2076 Ashwin · Q53 marksand cons.

2075 Chaitra · Q54 marksList the problems of Lamports clock with example.

2070 Ashad · Q52 marksand drawbacks.

Lamport's clock guarantees one direction only:

abC(a)<C(b)

but the converse is false. From C(a)<C(b) nothing can be concluded, because two entirely concurrent events may have picked up those numbers independently. It is therefore said not to be a true clock.

Example. Process P1 performs a local event and stamps it 3. Process P2, which has exchanged no message with P1, performs a local event and stamps it 5. Comparing 3 and 5 suggests the first happened before the second, but the two events are concurrent and neither influenced the other.

The other problems:

  • It cannot detect causality, only respect it, so it cannot be used to decide whether two events are causally related or concurrent.
  • It gives only a partial order; a total order has to be faked by breaking ties with the process identifier.
  • The counters of different processes are not comparable as quantities, only as an ordering.

The approach that avoids the issue is the vector clock, in which each process carries an array of counters, one per process, so that ab holds if and only if V(a)<V(b) and causality can be read off the timestamps.

Why physical clock synchronisation is difficult and necessary HOT 5/22

Asked 5 times

2081 Bhadra · Q42 marksHow did the international atomic clock establish?

2074 Ashwin · Q52 marksWhy clock synchronization is necessary?

2072 Chaitra · Q52 marksWhy it is difficult to synchronize physical clock?

2072 Kartik · Q62 marksWhy it is difficult to synchronize physical clock?

2071 Shrawan · Q43 marksWhat are the common problems of physical clock synchronization algorithms?

Why it is necessary. Time stamps decide the order of events, the validity of certificates and leases, the consistency of replicated data, and which version of a file is newer, so machines that disagree about the time produce wrong results.

Why it is difficult, and the common problems of the algorithms.

  • No clock can be read instantly. Reading a remote clock costs a message, and the reply is already out of date when it arrives.
  • Message delay is variable and unbounded. The algorithms assume the round trip is split equally between the two directions, which is only approximately true, and the assumption fails badly on a wide area network.
  • Crystals drift at different rates with temperature and age, so any correction decays and must be repeated.
  • A clock must never be set backwards, since that would let a file appear to be modified before it was created, so a fast clock can only be slowed gradually.
  • Single points of failure: Cristian's time server and Berkeley's master are each one machine whose failure stops synchronisation.
  • Faulty clocks can corrupt an average unless they are detected and excluded.

International atomic time. A second is defined as 9,192,631,770 transitions of the caesium 133 atom. TAI is the average of more than 200 caesium clocks kept in national standards laboratories, and UTC is TAI with leap seconds inserted to keep it within 0.9 seconds of solar time. A time server takes its time from a radio or satellite broadcast of UTC.

Global state, cuts and their types HOT 4/22

Asked 4 times

2081 Bhadra · Q10a4 marksWrite short notes on: Global state and state recording technique

2080 Baishakh · Q9b4 marksWrite short notes on: Strongly Consistent CUT in DS

2079 Bhadra · Q44 marksDefine cuts of a distributed computation along with its types.

2073 Shrawan · Q56 marksDetermine the types of distributed CUT in the following figure.

The global state of a distributed system consists of the local state of each process, that is the messages it has sent and received, together with the state of each channel, that is the messages sent but not yet received. It is difficult to record because there is no global clock, so the local states are taken at different moments.

A cut of a distributed computation is a subset of its history containing, for each process, all its events up to some point. The last event of each process is the frontier of the cut.

Types of cut.

  • Consistent cut: for each event it contains, it also contains every event that happened before that event. Equivalently, every message received inside the cut has its send inside the cut. On a diagram, no message arrow crosses the cut from right to left.
  • Inconsistent cut: some message is received inside the cut but sent after it, so the sender cannot be identified with that cut. Such a state never existed and cannot be used.
  • Strongly consistent cut: a consistent cut that in addition has no message in transit across it at all, so every send inside the cut also has its receive inside the cut.

A global state is consistent if it corresponds to a consistent cut, and only a consistent global state may be used as a checkpoint or as the basis of a decision.

State recording technique. The Chandy and Lamport snapshot algorithm records a consistent global state while the system continues to run, by sending a marker message down every channel; a process records its own state when it first sees a marker, and records each incoming channel's state as the messages received on it between that moment and the marker arriving on that channel.

Distributed debugging PIN 3/22

Asked 3 times

2078 Bhadra · Q10b4 marksWrite short notes on: Distributed Debugging

2073 Shrawan · Q54 marksWhat are the principle applications of state recording and distributed debugging?

2071 Shrawan · Q9d4 marksWrite short notes on (Any Three): Distributed Debugging

Distributed debugging is the problem of deciding whether a global predicate, a condition over the global state such as two processes being in the critical section at once, ever held, when no process can observe the whole system.

  • A predicate is stable if it stays true once true, as deadlock and termination do, and a single snapshot is enough to detect it.
  • Most predicates are unstable: they may hold at one instant and not the next, so a snapshot may simply miss them.

Method. Each process sends its state changes, with a vector timestamp, to a monitor process. The monitor uses the timestamps to build the lattice of all consistent global states compatible with what it received, and evaluates the predicate over that lattice, reporting either possibly the predicate, meaning some consistent global state satisfies it, or definitely the predicate, meaning every possible execution passed through a state that satisfies it.

Principal applications of state recording and distributed debugging: detecting distributed deadlock; detecting termination of a distributed computation; checkpointing for recovery after a failure; distributed garbage collection; and evaluating safety and liveness properties of a running system.

6Coordination and agreement

Mutual exclusion and its requirements HOT 5/22

Asked 5 times

2081 Bhadra · Q52 marksWhat are the fundamental requirements of Mutual Exclusion in DS?

2080 Bhadra · Q62 marksDefine mutual exclusion in distributed system.

2073 Shrawan · Q62 marksDefine distributed coordination in DS?

2072 Chaitra · Q62 marksWhat are the basic requirements for mutual exclusion in distributed system?

2070 Chaitra · Q72 marksHow does mutual exclusion help in co-ordination in distributed system?

Mutual exclusion is the mechanism that allows only one process to enter the critical section at a time, so that concurrent access to a shared resource cannot produce a race condition. In a distributed system there are no shared variables and no common kernel, so it must be built from message passing alone, which is why it is called distributed mutual exclusion.

Distributed coordination is the wider activity of making independent processes act consistently without shared memory: mutual exclusion, election of a coordinator, ordered multicast and agreement are all forms of it. Mutual exclusion contributes to coordination by serialising access to every shared resource, so that the processes see a single consistent sequence of updates instead of interfering with one another.

The fundamental requirements.

  • Safety: at most one process may execute in the critical section at a time.
  • Liveness: a process is granted entry if no other process is executing within the critical section, so every request is eventually satisfied and there is neither deadlock nor starvation.
  • Ordering or fairness: requests are granted in happened before order, so a request made earlier is served earlier.

The need for an election algorithm HOT 5/22

Asked 5 times

2081 Bhadra · Q52 marksWhy is election applicable in DS?

2080 Baishakh · Q52 marksWhy election is important in DS?

2075 Ashwin · Q72 marksWhat is the need of an election algorithm?

2071 Chaitra · Q42 marksWrite the importance of election algorithm.

2069 Chaitra · Q62 marksPresent a practical scenario where you need an election algorithm.

Leader election is the process of designating a single process as the coordinator of a task distributed among several nodes, so that after it has run every node recognises the same unique node as the leader. Many distributed algorithms need one process to act as coordinator, and that process must be replaceable when it fails.

Where it is needed.

  • Clock synchronisation: Berkeley's algorithm needs a master to poll the others and average the times, and a new master when it fails.
  • Mutual exclusion: the central coordinator algorithm needs a coordinator at initialisation and whenever it crashes; the token ring algorithm needs a process elected to generate a new token when the token holder fails.
  • Replication: passive replication needs a new primary replica manager when the primary fails.
  • Any distributed computation: a distributed algorithm does not assume a central coordinator already exists, so a master must be chosen to distribute the sub problems among the slaves and collect the partial results.

A practical scenario. A cluster keeps one primary database server and several backups. When the primary crashes, the backups detect the silence and must agree at once on which of them takes over; electing two would corrupt the data and electing none would stop the service. An election algorithm decides it deterministically.

Token based and non token based compared PIN 3/22

Asked 3 times

2080 Baishakh · Q52 marksCompare non token and token based mutual exclusion.

2078 Bhadra · Q64 marksCompare and contrast token based mutual exclusion algorithm and non-token based mutual exclusion algorithm.

2072 Chaitra · Q62 marksand compare it with token based algorithm.

PointNon token (permission based)Token based
Basis of entryPermission collected from the other processesPossession of a single unique token
How safety holdsBy the rules for granting permissionBecause only one token exists
OrderingBy logical clock timestampsBy the order in which the token is passed
Messages per entryLamport 3(N1), Ricart-Agrawala 2(N1)N1 requests and one token, or none if the token is held
Traffic when idleNoneThe ring token keeps circulating
Effect of a crashAny crash blocks entry, since its reply never arrivesHarmless unless the token holder crashes, and then the token must be regenerated
Main riskMessage overhead and N points of failureToken loss and token duplication
ExamplesCentral coordinator, Lamport, Ricart-AgrawalaRicart-Agrawala token algorithm, token ring

The centralized algorithm compared with both: it needs 3 messages and a delay of 2 message times but has a single point of failure; the distributed permission based algorithm needs 2(N1) messages and a delay of 2(N1) message times and any crash is fatal; the token ring needs between 1 and unbounded messages and a delay of 0 to N1, and its risk is a lost token.

Performance issues of the non token algorithm PIN 1/22

Asked once

2071 Shrawan · Q52 marksMeasure the performance issue of non-token based Ricart-Agrawal Algorithm.

  • Message traffic is expensive. Every entry costs 2(N1) messages, N1 requests and N1 replies, so the load grows linearly with the number of processes even though only one resource is contended.
  • Every process must take part in every entry, including processes that have no interest in the resource, which wastes bandwidth and processing.
  • The failure of any one process blocks progress, because entry requires a reply from every other site. A single crash therefore stops the whole system, so there are now N points of failure rather than one.
  • Client delay is high: a requesting process waits for the slowest of N1 replies before it can enter.

The alternative that addresses these issues is a token based algorithm, in which a single token carries the right to enter: entry costs at most N1 requests and one token transfer, costs nothing at all when the token is already held, and the failure of a process that is not holding the token does not prevent progress.

Feedback suppression in multicast PIN 1/22

Asked once

2075 Ashwin · Q11c3 marksWrite short notes on: Feedback suppression mechanism in M-cast communication

The problem is feedback implosion. If every receiver of a multicast acknowledges every message, a sender with a thousand receivers is flooded with a thousand acknowledgements per message, and the reliability mechanism becomes the bottleneck.

The mechanism.

  • Receivers send negative acknowledgements only, and only when a gap in the sequence numbers shows that a message was missed, so nothing is sent while all is well.
  • A negative acknowledgement is multicast to the whole group, not sent to the sender alone.
  • Each receiver waits a random delay before sending its own negative acknowledgement, and if it sees another process report the same gap during that delay it suppresses its own.
  • The sender, or any member holding the message, retransmits it by multicast, so every receiver that missed it is repaired at once.

The result is roughly one negative acknowledgement and one retransmission per lost message however many receivers there are, which is what allows scalable reliable multicast. Its costs are the random delay added to recovery and the traffic imposed on receivers that did not lose anything.

7Replication

Reasons, requirements and challenges of replication TOP 8/22

Asked 8 times

2081 Bhadra · Q63 marksWhat are the benefits and drawbacks of Replication in DS?

2080 Bhadra · Q72 marksWhat is the requirement for replications?

2079 Bhadra · Q63 marksList the challenges of replication in DS.

2078 Bhadra · Q72 marksMention the requirements and challenges of replication.

2073 Shrawan · Q76 marksDefine replication and fault tolerance in DS and explain why are they necessary?

2072 Chaitra · Q73 marksWhat are the reasons for Replication?

2072 Kartik · Q74 marksWhat are the reasons for replicating the service provide?

2070 Chaitra · Q83 marksWhat are the major objectives for replication in distributed system?

Replication is the maintenance of multiple copies of data at multiple computers. Fault tolerance is the ability of a service to keep meeting its specification while some of its components have failed. They are necessary because a single server is both a performance bottleneck and a single point of failure, and a distributed system is expected to stay usable when part of it is down.

Reasons and benefits.

  • Performance enhancement: a copy placed near the process that uses it reduces the time to access the data, as a browser cache removes the latency of refetching a page.
  • Increased availability: the data is still reachable when a server fails. If each of n servers has an independent probability p of being down, availability is 1pn, so two servers with a 5 percent failure chance give 99.75 percent.
  • Fault tolerance: a correct answer is still returned when a replica fails or misbehaves, so a server crash does not bring the whole system down.
  • Scalability: read load is divided among the replicas, so the service grows without any machine working harder.

Requirements and challenges.

  • Replication transparency: the client must not know how many copies exist or which one answered.
  • Consistency: if one copy is modified it becomes inconsistent with the rest, so every copy must be updated; this is the central drawback and the whole cost of replication.
  • Update propagation: deciding what is sent, the value or the operation, and whether it is sent eagerly or lazily.
  • Cost: extra storage, and network traffic that grows with the number of replicas, so writes get worse as reads get better.
  • Placement: replicas must be near the clients and independent in their failures, or the availability arithmetic does not hold.

Active and passive replication compared HOT 7/22

Asked 7 times

2080 Bhadra · Q76 marksCompare passive and active replication architectures with necessary figures and steps.

2079 Bhadra · Q62 marksHow it is differ than active replication model?

2078 Bhadra · Q72 marksHow it is differ than passive model?

2076 Chaitra · Q62 marksHow is it differ from active replication?

2075 Ashwin · Q83 marksDifferentiate between passive and active replication approach.

2074 Ashwin · Q73 marksDifferentiate between active and passive replication.

2069 Chaitra · Q72 marksCompare passive replication with active replication approach.

Lecture note figure: passive replication with clients reaching one primary that updates the backups, beside active replication where every client request reaches every member of the replica group
PointActive replicationPassive replication
Who executes the requestEvery replica managerOnly the primary
Request deliveryTotally ordered reliable multicast to the groupOrdinary request to the primary alone
Where the work of the protocol fallsThe coordination phase, by orderingThe agreement phase, by updating the backups
DeterminismRequiredNot required
Traffic when healthyHigher: every request reaches every replicaLower: one request and one update
Replica failureInvisible, with immediate failoverA backup failing is harmless; the primary failing needs an election and a pause
Byzantine failuresTolerated, by comparing the responsesNot tolerated, since a wrong primary is believed
ComplexityHigher, because of the ordered multicastLower, and it can be built on ordinary RPC
RecoveryNothing to recoverLonger recovery, with possible loss of the last operation

The steps. Active: multicast the request in total order, every replica executes, any reply is returned. Passive: send to the primary, the primary executes, the primary updates the backups and waits for acknowledgements, the primary replies.

Replication as a scaling technique PIN 3/22

Asked 3 times

2075 Chaitra · Q72 marksHow replication is used as a basic scaling technique in distributed system?

2073 Shrawan · Q72 marksExplain how replication enhanced scalability for DS.

2070 Ashad · Q72 marksHow do you say that replication is one of the scaling techniques in Distributed System?

Replication is one of the three basic scaling techniques, alongside hiding communication latency and distributing the work.

  • It removes the single server bottleneck. With n replicas the read load is divided by n, so the service handles many more clients without any machine working harder, which is size scalability.
  • It shortens the distance. A replica placed near a group of clients turns a wide area request into a local one, which is the only way to overcome the delay of a long link, and is therefore geographical scalability.
  • Caching is replication with a short life, and browser, proxy and content delivery caches are what allow the web to carry its load.
  • It removes the single point of failure, so the service can be operated by several administrations, which is administrative scalability.

The cost. Replication improves reads and makes writes worse, because every update must reach every replica and keeping them consistent costs coordination messages. Scalable systems therefore weaken the consistency they promise rather than reduce the replication, which is why lazy propagation and gossip are used at large scale.

Consistency models PIN 2/22

Asked 2 times

2080 Baishakh · Q65 marksWhat are the different consistency models applicable in a distributed system?

2076 Ashwin · Q78 marksSpecify Data Centric consistency models and explain any one of them in detail.

A consistency model is the contract between the processes and the data store, stating what a read may return when the data is replicated. Data centric models describe what the store promises to all processes; the models below are listed from strongest to weakest, and each one costs less than the one above it.

Lecture note tables: the consistency models that use no synchronisation operations, strict, sequential, causal, processor and PRAM, each with a one line description, and below them the models that do use synchronisation, weak, release and entry
  • Strict consistency: a write by any processor is seen instantaneously by all processors, as if a global clock existed. It is the strongest and is unimplementable in a distributed system.
  • Sequential consistency: a write need not be seen instantly, but writes by different processors must be seen in the same order by all processors.
  • Causal consistency: only writes that are causally related need to be seen in the same order by all processes; concurrent writes may be seen in different orders.
  • Processor consistency: processors agree on the order of writes made by one processor and on writes to the same location, but not on writes by different processors to different locations.
  • PRAM consistency: all processes see the writes of each single processor in the order they were issued, while writes from different processors may be seen in different orders.
  • Weak consistency: shared data is only guaranteed consistent after a synchronisation operation.
  • Release consistency: separates the acquire on entering a critical region from the release on leaving it; on acquire all local operations must be complete, and on release all local changes are propagated.
  • Entry consistency: a variant of release consistency in which every shared variable has its own synchronisation variable, so an acquire on one variable requires only that variable's operations to complete, which allows different critical sections to run concurrently.

Sequential consistency in detail. Lamport's definition is that the result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in that sequence in the order its program specified. So all processes agree on one interleaving of the operations, and each process's own operations keep their program order, but that interleaving need not match real time: a write may become visible to others later than it was issued. It is implemented by making every replica apply updates in one agreed total order, which is exactly totally ordered multicast, and it is the model active replication provides.

Handling concurrent invocations on replicated objects PIN 1/22

Asked once

2070 Ashad · Q74 marksHow to handle concurrent invocations with object replication in distributed object based system?

Object replication forms physical replicas of objects, each stored at a single computer and tied to some degree of consistency. Because an object has methods, two clients may invoke operations on it at the same time, and those concurrent accesses must be managed so the state of the replicas stays consistent.

Where the concurrency can be handled.

  • In the object itself: the object provides its own locking, as a synchronized method does. Simple, but it protects only one replica.
  • In the middleware: the object adapter or the object request broker serialises the invocations before they reach the object, so every replica applies them in the same order. This is the coordination phase of the replication model.
  • By totally ordered multicast: every replica receives the same invocations in the same order, so deterministic objects starting from the same state reach the same state without any locking. This is what active replication does.
  • By a primary: only one replica executes the invocation and the others are told the resulting state, so concurrency is resolved in one place. This is what passive replication does.

The front end hides all of this from the client, which issues an ordinary invocation and receives a single result.

Fault tolerant services PIN 1/22

Asked once

2072 Kartik · Q74 marksDiscuss about fault tolerant services.

A system has failed when it does not meet its specification, and a fault tolerant service is one that continues to meet its specification while some of its components are faulty. Replication is how it is achieved: a service built from several replica managers can mask the failure of some of them.

Classes of fault. Transient faults occur once and disappear, so a retry works. Intermittent faults occur, vanish and reappear, such as a loose connector. Permanent faults continue until repaired, such as a burnt out chip or a disk head crash. Processor failures are either fail silent, where the processor stops and does not respond, or Byzantine, where it continues to run but gives wrong answers.

Three kinds of redundancy.

  • Information redundancy: extra bits that let a garbled value be recovered.
  • Time redundancy: perform the operation again, which works only for transient faults.
  • Physical redundancy: extra components, organised either as active replication, using them all at once, or as primary backup, using the spare when one fails.

The issues for physical redundancy are the degree of replication required, the average and worst case performance in the absence of faults, and the average and worst case performance when a fault occurs.

How much replication is needed. A system is k fault tolerant if it survives faults in k components and still meets its specification. It needs k+1 processors to tolerate k fail-stop faults, because one correct processor is left, and 2k+1 to tolerate k Byzantine faults, because k may give wrong replies while k+1 give the correct one, so a majority vote still wins.

8Transactions and concurrency control

Flat and nested transactions HOT 7/22

Asked 7 times

2079 Bhadra · Q74 marksDefine flat and nested transactions.

2078 Bhadra · Q92 marksWhat are the Flat and Nested Transactions?

2072 Chaitra · Q82 marksWhat do you mean by nested transactions?

2072 Kartik · Q54 marksDefine flat and nested transaction.

2071 Chaitra · Q9c4 marksWrite short notes on: Flat versus nested locks

2071 Shrawan · Q74 marksWhat are the relationships between parent and child transactions in DS?

2069 Chaitra · Q93 marksWhat are the flat and nested transactions?

A flat transaction is a single sequence of operations with one begin and one end, and when it involves several servers the client completes each request before going on to the next, so the servers are accessed sequentially. A nested transaction is composed of other transactions: the outermost is the top level transaction and the others are sub-transactions, which may themselves open further sub-transactions. Sub-transactions at the same level may run concurrently, but their access to common objects is serialised.

Lecture note figure: a flat distributed transaction in which one client transaction calls three servers in sequence, beside a nested transaction in which the top level opens subtransactions that themselves open further subtransactions

The relationship between parent and child, as five commit rules.

  1. A transaction may commit or abort only after its child transactions have completed.
  2. When a sub-transaction completes it makes an independent decision either to commit provisionally or to abort.
  3. When a parent aborts, all of its sub-transactions are aborted.
  4. When a sub-transaction aborts, the parent can decide whether to abort or not.
  5. If the top level commits, all the sub-transactions that have provisionally committed can commit, provided none of their ancestors has aborted.

Flat against nested locking. In a flat transaction the locks belong to the one transaction and are released only when it ends, so a long transaction holds everything for its whole life. In a nested transaction the locks are held by a sub-transaction on behalf of the whole family: a lock acquired by a child is inherited by its parent when the child commits provisionally, and released only when the top level ends, while a child aborting releases its own locks at once. Sub-transactions of the same parent must still not hold conflicting locks on the same object, which is why their access is serialised.

Advantages of nesting: sub-transactions at one level may run concurrently, which gives higher throughput; and a sub-transaction may fail and be retried without abandoning the whole transaction.

Cascading aborts and two version locking HOT 4/22

Asked 4 times

2075 Ashwin · Q92 marksWrite down the rule of two-version locking.

2074 Ashwin · Q84 marksHow cascading aborts occurs and solved?

2072 Kartik · Q84 marksHow cascading aborts occurs and can be solved?

2071 Shrawan · Q78 marksWrite the problems of locking with the solutions to avoid it.

How a cascading abort occurs. A transaction releases a lock before it has committed, so another transaction reads or overwrites the uncommitted value, which is a dirty read or a premature write. If the first transaction then aborts, the value the second one used never existed, so the second must abort as well, and any transaction that used its output must abort in turn. The aborts cascade through the system, and a single failure can undo a large amount of unrelated work.

How it is solved.

  • Strict two phase locking, the standard answer: hold every lock until commit or abort, so no uncommitted value is ever visible and the cascade cannot start.
  • Tentative versions: writes go to a private version that is applied to the real object only on commit, which is what timestamp ordering and optimistic concurrency control do.
  • Commit dependency: allow the read but record that the reader may not commit before the writer, and abort it if the writer aborts.

The other problems of locking, with their solutions: deadlock, solved by detection with a wait for graph, by timeouts, or by ordered locking; reduced concurrency, relieved by two version locking and by hierarchic locks of mixed granularity; and overhead, reduced by locking at a coarser granularity.

The rules of two version locking. It allows a write to proceed while other transactions read the committed version, using three kinds of lock, read, write and commit:

  • A transaction may not set a write lock on an object that already has an uncommitted write lock or a commit lock set by another transaction.
  • A transaction may not set a read lock on an object that has a commit lock set by another transaction.
  • A write lock is converted into a commit lock when the transaction commits; if any other transaction holds a read lock on that object, the committing transaction waits until those transactions finish.

It gives more concurrency than ordinary read and write locks, because readers are never blocked by a writer during the working phase, at the price of a delay at commit time.

Locks and two phase locking PIN 3/22

Asked 3 times

2081 Bhadra · Q73 marksWhat are the benefits and drawbacks of using locks in distributed transaction processing?

2073 Shrawan · Q84 marksWhat is LOCK and DEADLOCK in DS?

2071 Chaitra · Q81 markDefine lock in concurrency control.

A lock is a marker a server sets on an object to reserve it for one transaction. The server attempts to lock any object that a client's transaction is about to use, and a request to lock an object that is already locked in a conflicting way is suspended until it is unlocked. Two kinds are used: a read lock, which is shared, and a write lock, which is exclusive.

A deadlock is the situation in which two transactions are waiting and each depends on the other to release a lock, so neither can proceed.

Lecture note table: the lock compatibility rules for one object, showing that a read request is granted when no lock or a read lock is set and waits under a write lock, and that a write request waits under either kind of lock

Conflict rules: a request for a write lock is delayed by a read lock held by another transaction, and a request for either kind is delayed by a write lock held by another transaction.

Two phase locking is the rule that a transaction may take no new lock after it has released one, which gives a growing phase and a shrinking phase. Strict two phase locking holds every lock until the transaction commits or aborts.

Benefits of locking.

  • It guarantees serial equivalence, so the result is always the same as some serial order.
  • It is simple to implement and needs no clock synchronisation or version storage.
  • A transaction is made to wait rather than aborted, so no work is thrown away, which suits update heavy workloads.
  • Strict two phase locking also prevents dirty reads and cascading aborts.

Drawbacks of locking.

  • Overhead: lock maintenance is a cost that a system without concurrent access does not pay, and it is paid on every operation.
  • Deadlock: locks can lead to deadlock, and prevention by locking everything in advance reduces concurrency, while detection or timeout is unsatisfactory in an interactive program.
  • Reduced concurrency: a locked object cannot be used by anyone else, and to avoid cascading aborts the locks cannot be released until the end of the transaction.
  • Starvation is possible, and in a distributed system the deadlocks span servers so no one server can see them.

Nested and distributed transactions compared PIN 3/22

Asked 3 times

2081 Bhadra · Q82 marksCompare nested transaction with distributed transaction.

2075 Chaitra · Q82 marksCompare nested transactions and distributed transactions.

2070 Chaitra · Q92 marksDifferentiate between nested transaction and distributed transaction with examples.

A nested transaction is one composed of other transactions, so the word describes its structure. A distributed transaction is one that accesses objects managed by several servers, so the word describes its location. A transaction can be both.

Lecture note figure: a nested transaction whose subtransactions run against two different independent databases, beside a distributed transaction whose subtransactions run against two physically separated parts of the same database
PointNested transactionDistributed transaction
What it meansTransactions inside transactionsOne transaction across several servers
DataMay be two different independent databasesTwo physically separated parts of the same database
CommitSub-transactions commit provisionally and the top level decidesAll participants commit or all abort, decided by a coordinator
Partial failureA sub-transaction may abort while the parent continuesOne participant aborting forces every participant to abort
Protocol usedThe nesting commit rulesAn atomic commit protocol, normally two phase commit
ExampleBooking three flights for one trip, each reservation committing separatelyTransferring money from an account at one bank to an account at another

Methods for concurrency control and their comparison PIN 2/22

Asked 2 times

2080 Baishakh · Q72 marksBriefly explain different methods for concurrency control.

2069 Chaitra · Q94 marksDescribe the methods for concurrency control in distributed system.

There are three methods, all aiming at serial equivalence, that is at an interleaving whose effect is the same as some serial order.

  • Locking. The server locks each object a transaction is about to use; read locks are shared and write locks are exclusive, and a conflicting request waits. Two phase locking forbids any new lock after the first release, and strict two phase locking holds every lock until commit or abort. It is pessimistic and makes a transaction wait.
  • Optimistic concurrency control. The transaction runs freely on tentative values in a working phase, is checked in a validation phase against overlapping transactions, and its values are made permanent in an update phase. It is optimistic and aborts the loser at the end.
  • Timestamp ordering. Every transaction gets a timestamp at its start and the serial order is fixed to be timestamp order; each read and write is checked against the read and write timestamps of the object and the transaction is aborted immediately if it is out of order. It is pessimistic and aborts rather than waits.
PointLockingTimestamp orderingOptimistic
ApproachPessimisticPessimisticOptimistic
On conflictWaitAbort immediatelyAbort at validation
DeadlockPossibleImpossibleImpossible
Best forUpdate heavy workRead only and read heavy workLow conflict work
OverheadThe lock tableTimestamps and several versionsRead and write sets, tentative versions

Timestamp ordering is better than locking for read only transactions; locking is better when operations are predominantly updates; and with optimistic control all transactions are allowed to proceed and only the losers pay.

Concurrency control in distributed transactions PIN 2/22

Asked 2 times

2071 Chaitra · Q84 marksHow can concurrency be controlled in distributed transactions?

2070 Ashad · Q86 marksExplain the different methods of concurrency control in distributed transactions.

Each server applies concurrency control to its own objects, and the problem is to make the servers' decisions agree on one serial order for the whole transaction.

  • Locking. Each server keeps its own lock manager for its own objects. Locks cannot be released until the transaction is known to have committed or aborted everywhere, so locking is used together with two phase commit. Its consequence is distributed deadlock, because the wait for relations now span servers and no single server can see the cycle. The lock managers may be arranged as centralized 2PL, with one scheduler for the system; primary copy 2PL, with each data item assigned a primary copy whose lock manager is responsible for it; or distributed 2PL, with a scheduler at every site, where a read takes a lock on one copy and a write takes locks on all the copies.
  • Timestamp ordering. The coordinator issues a globally unique timestamp, normally the local time paired with the server identifier, and passes it to every server with the request. Every server then orders that transaction's operations by the same timestamp, so one serial order is enforced everywhere. It requires the servers' clocks to be roughly synchronised.
  • Optimistic concurrency control. Each server validates the transaction against the operations on its own objects, but a transaction may pass at one server and fail at another. Validation must therefore be made global, either by validating the servers in a fixed order or by carrying out the validation in the first phase of the commit protocol.

Transactions and why they are necessary PIN 1/22

Asked once

2076 Ashwin · Q83 marksWhy is it necessary to maintain transaction?

A transaction is a sequence of requests to a server by a client, performed as an indivisible unit, that keeps all the objects in a consistent state. Its guarantees are the ACID properties: atomicity, it is all or none; consistency, it moves the system from one consistent state to another; isolation, one transaction cannot interfere with another; and durability, its effects survive a crash because the log is on non volatile storage.

Why it is necessary.

  • To survive a server crash. Either all the operations complete or none of them have any effect, so a crash in the middle of transferring money cannot leave the money in neither account.
  • To prevent interference between clients. Without isolation, concurrent operations produce the lost update problem, where one client's update overwrites another's, and the inconsistent retrieval problem, where a client reads the system halfway through somebody else's work.
  • To keep the objects consistent, which is the point of the server's existence: a bank's total must be unchanged by a transfer.
  • To let the client reason simply, because the client can treat a whole sequence of operations as one indivisible step and needs no locking of its own.

Drawbacks of 2PL and how strict 2PL overcomes them PIN 1/22

Asked once

2080 Baishakh · Q76 marksWhat are the drawbacks of 2PL and how does strict 2PL overcomes those?

Plain two phase locking requires only that no new lock is taken after the first release, so a transaction may release its locks gradually during its shrinking phase, before it has committed.

Lecture note graph: the number of locks held by a transaction rising in steps through the growing phase to the lock point, then falling in steps through the shrinking phase

Its drawbacks.

  • Dirty reads. Once a lock is released, another transaction can read a value the first transaction wrote but has not yet committed.
  • Cascading aborts. If that first transaction then aborts, every transaction that read its output must abort too, and so on down the chain.
  • Premature writes. Another transaction may overwrite an uncommitted value, so an abort cannot simply restore the old one.
  • Recovery is unsafe, because the objects may have been read by others before they were written to permanent storage.
  • The usual problems of locking remain: deadlock, lock maintenance overhead and reduced concurrency.

How strict two phase locking overcomes them. Every lock is held until the transaction commits or aborts, so the shrinking phase happens in one instant at the end.

Lecture slide: strict two phase locking, in which all the locks a transaction holds are released together at the moment it commits rather than gradually
  • No other transaction can read or write an object the transaction has touched until its outcome is known, so dirty reads and premature writes are impossible.
  • Because nothing can read an uncommitted value, cascading aborts cannot start.
  • Recovery is safe, since the objects are released only after the updates are permanent.

The cost is lower concurrency, since locks are held for the whole transaction rather than released as soon as they are finished with, and deadlock remains possible.

9Fault tolerance

Fault, error and failure HOT 6/22

Asked 6 times

2081 Bhadra · Q93 marksDefine fault, error and failure.

2080 Bhadra · Q94 marksDefine faults, failures and errors.

2080 Baishakh · Q83 marksDefine faults, error and failures.

2076 Chaitra · Q62 marksWhat is fault?

2070 Chaitra · Q101 markWhat do you mean by fault tolerant system?

2069 Chaitra · Q102 marksWhat do you mean by faults, failures and errors?

A fault is a defect within a hardware or software unit. An error is a deviation from accuracy, that is the incorrect internal state that a fault produces. A failure is the condition that occurs when an error causes the system to function incorrectly, which is the point at which the user sees it.

They form a chain: the fault is the cause, the error is the state, the failure is the visible effect. A fault may exist for a long time without producing an error, and an error may be corrected before it becomes a failure, which is exactly what fault tolerance does.

A fault tolerant system is one that continues to provide its services despite faults occurring in some of its nodes, and it is k fault tolerant if it functions properly even when k of its nodes fail at the same time.

Process resilience HOT 5/22

Asked 5 times

2078 Bhadra · Q10d4 marksWrite short notes on: Process Resilience

2074 Ashwin · Q10c4 marksWrite short notes on: Process Resilience

2073 Shrawan · Q9a3 marksWrite short notes on: Process Resilience

2071 Chaitra · Q9d4 marksWrite short notes on: Process Resilience

2069 Chaitra · Q104 marksHow do you handle faults in Distributed System? Explain process resilience approach in brief.

Process resilience is a mechanism to protect against faulty processes by replicating and distributing computations in a group. Each member of the group is identical; a message sent to the group is delivered to all of them, and only one performs the required service. If one process fails, another is still able to function and serve the pending request, so the failure is masked from the client.

Faults in a distributed system are handled in four ways: prevention by careful design, masking by redundancy, detection by heartbeats and timeouts, and recovery by rolling back to a checkpoint. Process resilience is the masking step applied to processes.

Two group organisations.

PointFlat groupHierarchical group
RolesAll processes have equal rolesOne coordinator handles all the communication
ControlCompletely distributedCentralised in the coordinator
Fault toleranceGood, since no member is special and information is exchanged at onceNot completely fault tolerant: the coordinator is a single point of failure
OverheadHigher, because decisions are collectiveLower
ImplementationDifficultEasy

How much replication is needed: k+1 processes to tolerate k fail-stop failures, since one correct process is left, and 2k+1 to tolerate k Byzantine failures, so that the correct processes outvote the faulty ones. A group membership service keeps the list of members current and tells the survivors when it changes.

K fault tolerant systems PIN 3/22

Asked 3 times

2075 Chaitra · Q95 marksExplain the basic principle of K-fault tolerant.

2074 Ashwin · Q92 marksWhat is K-fault tolerant system?

2070 Ashad · Q92 marksWhat do you mean by K-fault tolerant?

A system is k fault tolerant if it can survive faults in k of its components and still meet its specification.

The basic principle is redundancy sized to the failure model, because how many spare components are needed depends on how badly a faulty one can behave.

  • k+1 processes for k fail-stop faults. A fail-stop process simply halts and gives no answer, so if k of them fail the one that remains still gives the correct answer and can be believed without a vote.
  • 2k+1 processes for k Byzantine faults. A Byzantine process keeps running and returns wrong answers, so the correct processes must outvote it: if k send wrong replies, k+1 still send the correct one, and a majority vote recovers it.
  • 3k+1 processes to reach agreement among themselves with k Byzantine processes, because there the value's source may also lie, so more than two thirds must be correct.

The processes must also be independent in their failures and, for voting to work, deterministic, so that correct processes given the same input produce the same output. Triple modular redundancy is the k equal to one case of the voting scheme.

Distributed commit PIN 3/22

Asked 3 times

2081 Baishakh · Q72 marksWhat do you mean by Distributed Commit?

2072 Kartik · Q42 marksWhat does distributed commit refer to?

2070 Ashad · Q11b4 marksWrite short notes on: Distributed commit

Distributed commit refers to the problem of having an operation performed by each member of a group of processes, or by none of them at all. It generalises transaction commit: for a reliable multicast the operation is the delivery of a message, and for a distributed transaction it is committing the transaction.

Three protocols.

  • One phase commit: the coordinator simply tells every process to perform the operation. Its flaw is that a process has no way to report that it cannot.
  • Two phase commit: a voting phase in which the coordinator sends a vote request and each participant answers ready or abort, then a completion phase in which the coordinator sends global commit if all voted ready and global abort otherwise. Any participant may veto. Its flaw is that a participant which has voted ready and then loses the coordinator is blocked, holding its locks until the coordinator returns.
  • Three phase commit: adds a precommit state between ready and commit, so a participant that reached precommit knows every participant voted yes and may commit alone. It is non blocking under a coordinator crash, costs an extra round, and still fails under a network partition.

Every state change is written to stable storage before the message that depends on it is sent, so a participant that crashes can read its log on recovery, ask the others what was decided, and reach the same outcome as everyone else.

Fault tolerance and the types of fault PIN 2/22

Asked 2 times

2076 Ashwin · Q98 marksWhat is fault tolerance? Explain different type of faults that may occur in a distributed system.

2071 Shrawan · Q84 marksHow do you avoid faults in DS?

Fault tolerance is the ability of a system to continue providing its services despite faults occurring in some of its nodes.

Types of fault by where they lie: node faults, program faults, communication faults and timing faults.

Types of fault by how long they last.

  • Transient: occurs once and then disappears, such as a lost bit caused by interference. A retry succeeds.
  • Intermittent: occurs, vanishes and reappears, such as a loose connector. The hardest to diagnose.
  • Permanent: continues until repaired, such as a burnt out chip, a software bug or a disk head crash.

Types of failure by what the faulty component does.

FailureBehaviour
Crash, or fail silentThe server halts, after behaving correctly until then
OmissionIt fails to receive a request or fails to send a reply
TimingThe response is correct but arrives outside the specified interval
ResponseThe response is wrong, in value or in state transition
Arbitrary, or ByzantineIt produces arbitrary responses at arbitrary times, possibly maliciously

How faults are avoided and handled. Fault prevention removes the causes by careful design and testing. Fault masking hides them with redundancy: information redundancy, extra bits to recover a garbled value; time redundancy, repeating the operation; and physical redundancy, extra components arranged as active replication or primary backup. Fault detection uses heartbeats, timeouts and checksums to find the fault. Fault recovery then restores a correct state by rolling back to a checkpoint or by correcting forward.

Dependability requirements of a fault tolerant system PIN 1/22

Asked once

2070 Ashad · Q92 marksWhat are the dependability requirements of fault tolerant system?

  • Availability: the system should be available for use at any given time.
  • Reliability: the system should run continuously without failure.
  • Safety: a temporary failure should not result in a catastrophe.
  • Maintainability: a failed system should be easy to repair.
  • Security: deliberate attacks on the system should be avoided or tolerated.

Availability and reliability are not the same: a system that fails briefly but very often is highly available and unreliable, while a system that never fails but is taken down for long maintenance periods is reliable and less available.

Reliable group communication PIN 1/22

Asked once

2075 Chaitra · Q10a4 marksWrite short notes on: Reliable Group Communication

Reliable group communication guarantees that a message multicast to a group of processes reaches every non faulty member of that group, despite lost messages and crashed processes.

Lecture slide: reliable one to many communication, showing a receiver that missed a message, an acknowledgement based scheme in which every receiver acknowledges, and a negative acknowledgement scheme in which only the receiver that missed the message reports it

Its properties: integrity, a correct process delivers a message at most once and only if it was sent to the group; validity, a correct process that multicasts a message eventually delivers it; and agreement, if a message is delivered to one correct process it is delivered to all of them.

Two feedback schemes.

  • ACK based: every receiver acknowledges every message, so the sender knows who has it. Correct, and the sender becomes a bottleneck, which is feedback implosion.
  • NACK based: a receiver reports only a gap in the sequence numbers, and multicasts that report so the others suppress their own feedback. It scales to large groups, and the sender must keep a history buffer.

Atomic multicast is the stronger guarantee that all the processes receive the message or none at all, and that all of them receive messages in the same order. Process crashes are handled with a group view: every message is associated with the set of members at the time it was sent, and all processes must agree on that view. This is virtual synchrony, in which a message is delivered to every member of the view or to none, and a view change acts as a barrier, so a crashed process is simply removed from the next view.

10Case studies

Mach HOT 6/22

Asked 6 times

2080 Baishakh · Q9a4 marksWrite short notes on: MACH

2079 Bhadra · Q9e3 marksWrite short notes on: MACH

2076 Chaitra · Q9e3 marksWrite short notes on: MACH

2076 Ashwin · Q10c4 marksWrite short notes on any two: Mach

2074 Ashwin · Q10b4 marksWrite short notes on: MACH

2073 Shrawan · Q9b3 marksWrite short notes on: Mach

Mach is a microkernel developed at Carnegie Mellon University from 1985 to support distributed and parallel computing while remaining compatible with UNIX. Its design principle is that the kernel provides only communication and memory management, and every other operating system service runs as a user level server.

The five abstractions it provides.

  • Task: an execution environment, that is an address space with rights to resources, and no thread of control of its own.
  • Thread: the unit of execution; a task may hold many threads sharing its address space.
  • Port: a unidirectional message queue held and protected by the kernel. A port is the only way to name a service: a send right permits communication with whatever is behind it, and exactly one task holds the receive right. A port set lets one thread wait on several ports.
  • Message: a typed collection of data sent to a port. Because the kernel understands the types, port rights and regions of memory may be passed inside a message.
  • Memory object: a region of virtual memory whose backing store is managed by a user level external pager, which is what allows a file system or a distributed shared memory to live outside the kernel.

Two features that make it efficient. Copy on write message passing maps the sender's pages into the receiver rather than copying them, so a large transfer costs a few page table entries. Location transparency through ports: a task sends to a port, and whether the receiver is local or remote is handled by the NetMsgServer, a user level process that forwards messages between machines.

UNIX compatibility is provided by running a BSD UNIX server as an ordinary user level task, so existing programs run unchanged. Mach became the base of NeXTSTEP and so of the macOS and iOS kernel. Its weakness is the usual microkernel one: a service call becomes two messages and two context switches, which is why production kernels move performance critical servers back inside.

JINI HOT 4/22

Asked 4 times

2080 Bhadra · Q10a4 marksWrite short notes on: JINI

2078 Bhadra · Q10a4 marksWrite short notes on: JINI

2072 Chaitra · Q9b4 marksWrite short notes on: JINI

2071 Chaitra · Q54 marksList the goals of JINI.

JINI is a coordination based system from Sun Microsystems, written in Java, that offers network plug and play of services: services may come and go without administration or reconfiguration, forming a federation rather than being centrally controlled.

Goals.

  • Spontaneous networking: communication is established dynamically, with no drivers installed and no manual configuration.
  • Plug and play of services, which are Java objects, so a device brings its own driver with it.
  • Federation, not central control: no machine owns the system.
  • One language everywhere: Java, using RMI and object serialisation so objects can move around the network.
  • Robustness: failure is expected and handled by leases rather than by administration.

Main components: the service, an entity another program, service or user can use; the client, which joins the federation to use a service; and the lookup service, a repository that keeps track of the services offered, stores each as a Java object and lets clients download them on demand.

Three protocols define its behaviour: discovery, how to locate the lookup service, by UDP multicast with group names or by unicast when the address is known; join, how a service registers a proxy and its attributes with the lookup service; and lookup, how a client finds a suitable service by interface and attributes and downloads its proxy.

Key terms: leasing, in which a resource is granted for a period and the grant is withdrawn unless renewed, which is what cleans up after a device that is simply unplugged; distributed event, by which components notify one another of state changes; and JavaSpaces, a tuple based store offering write, read and take, which uncouples clients and services in both time and reference.

TIB/Rendezvous PIN 2/22

Asked 2 times

2075 Ashwin · Q11b3 marksWrite short notes on: TIB/Rendezvous

2071 Chaitra · Q9b4 marksWrite short notes on: Rendezvous concept and implementation

TIB/Rendezvous is a publish and subscribe system built on subject based addressing: a message is addressed to a subject rather than to a receiver. Receiving a message on subject X is possible only if the receiver has subscribed to X, and publishing on subject X sends it to all the currently running subscribers to X.

Lecture note figure: five machines each running an RV daemon and RV library, some publishing on subject A or B and others subscribed to them, with the daemons multicasting each message to exactly the subscribers of that subject

Implementation.

  • Every machine runs an RV daemon, and every application process links the RV library, which talks to the local daemon.
  • A process publishes on a subject, and its daemon multicasts the message on the network.
  • Every daemon receives the multicast and passes it up only to its own processes that subscribed to that subject, so the filtering happens at the receiving end and the publisher needs to know nothing about the subscribers.
  • Subjects are hierarchical dotted names, so a subscription may name a whole subtree with a wildcard.

Its coordination properties: publisher and subscriber are referentially decoupled, since neither knows the other, and temporally coupled, since only running subscribers receive a message. There is no central broker, so no bottleneck and no single point of failure.

Its weakness is that every machine in the multicast group sees every message, which does not scale across a wide area network. The answer is content based routing, in which subscriptions are forwarded to the routers, which install filters and forward a message only along the paths where a subscriber exists.

Comparison of CORBA and Mach PIN 1/22

Asked once

2070 Chaitra · Q11a3 marksWrite short notes on: Comparison of CORBA and Mach

The two are not alternatives: CORBA is middleware above the operating system, and Mach is an operating system kernel below it.

PointCORBAMach
What it isA middleware specification, an object request brokerA microkernel
LayerAbove the operating system, below the applicationBelow the operating system services, above the hardware
Problem solvedHeterogeneity: objects in different languages on different machines invoking one anotherStructure: operating system services running outside the kernel
Unit of interactionAn object invoked through an interface defined in IDLA message sent to a port
NamingObject references, with a naming and a trading servicePort rights held by a task
LanguageNeutral, through IDL and language mappingsBelow languages, and written in C
DistributionBuilt in: the ORB hides the location of the objectAdded by the NetMsgServer, a user level forwarder
OriginObject Management Group, 1989Carnegie Mellon University, 1985
LegacyThe shape of modern RPC frameworksThe kernel of macOS and iOS

They can be used together: a CORBA ORB can run as an ordinary user level task on a Mach system, with its messages carried by Mach ports.

36 workings · asked 147 times in 22 papers · construction, then operation

Practical answers

The questions that ask how a thing works: the PV cell, the turbines, the wind machine, the fuel cells, the battery, the hybrid drive. Each answer names the parts first and then walks the operation in order, with the diagram to draw beside it. What a thing is, and every comparison, stays in Theory answers.

2Distributed objects and file system

HDFS operations: read, write, heartbeats and re-replication PIN 3/22

Asked 7 times, in 3 papers

2068 Chaitra · Q28 marksExplain how GFS handles client request?

2068 Chaitra · Q48 marksExplain the control flow of write mutation with diagram.

2068 Chaitra · Q58 marksSuppose your company got more investment so you can now increase your default replication order by 2 from current value 3 so as to make it your data more available and reliable. Suddenly master has to create two replicas of each file chunks. Yet, it has to satisfy client request which are more important than just replication. How does single master manage re-replication task?

2068 Chaitra · Q64 marksList and explain four main master operations in GFS.

2068 Baishakh · Q5b5 marksExplain the lease mechanism in GFS with examples.

2068 Baishakh · Q6b5 marksDiscuss re-replication and rebalancing role of GFS master.

2067 Mangsir · Q410 marksExplain data and control flow and working of lease mechanish in normal write operation of GFS.

How a client request is handled. The client sends the file name and the chunk index to the master; the master replies with the chunk handle and the locations of its replicas; the client caches that and then contacts the nearest replica directly, sending the chunk handle and a byte range. No file data passes through the master.

Lecture slide: a client reading files from HDFS, asking the name node for the block locations, receiving the list of data nodes for each block, and reading the blocks in sequence from the nearest data node

Control flow and data flow of a write mutation. The two flows are deliberately separated: control goes client to primary to secondaries, data goes along the fastest chain of machines.

Lecture slide: a pipelined write in HDFS, the client sending the block to the first data node, which passes it along to a second and then a third data node as it is received, with the name node told when the block is received
  1. The client asks the master which chunk server holds the lease for the chunk and where the other replicas are. If no one holds a lease the master grants one.
  2. The master replies with the primary and the secondaries; the client caches this.
  3. The client pushes the data to all replicas in a pipeline: it sends to the nearest replica, which forwards to the next as it receives, so each machine's outbound bandwidth is used once.
  4. When all replicas acknowledge the data, the client sends a write request to the primary.
  5. The primary assigns a serial number to this mutation and to every other it receives, and applies them in that order.
  6. The primary forwards the write request and the serial order to the secondaries, which apply the mutations in the same order.
  7. The secondaries acknowledge to the primary, and the primary replies to the client; any error makes the client retry.

The lease mechanism is what makes this work without the master. The master grants a lease on a chunk to one replica, the primary, for a limited time, typically 60 seconds, extendable by piggybacked requests. The primary alone serialises all concurrent mutations to that chunk, so every replica applies them in one consistent order while the master stays out of the data path. If the primary fails, the master simply waits for the lease to expire and grants a new one, which prevents two primaries existing at once.

Re-replication. Missing heartbeats tell the master a node is dead. It finds the blocks that node held in its metadata, sees which are now below their replication factor, and prioritises them by how far below they are and whether they block a client. It then instructs a surviving replica holder to copy the block to a chosen node, choosing the target by rack awareness and by disk utilisation, and it limits the number of clone operations so that re-replication never starves client traffic.

Lecture slide: re-replicating missing replicas, a dead data node detected by missing heartbeats, the name node consulting its metadata and the rack awareness script and instructing a surviving data node to copy the affected blocks

Rebalancing moves replicas to even out disk usage across the cluster and to fill new machines, and runs at a low rate for the same reason.

The four main master operations: namespace management and locking, replica placement using rack awareness, chunk creation, re-replication and rebalancing, and garbage collection of deleted files and stale replicas, with stale replica detection by chunk version number.

DNS: a distributed hierarchical database and its working HOT 6/22

Asked 6 times

2080 Bhadra · Q34 marksDefine queries and operation of distributed hierarchical DB: DNS.

2078 Bhadra · Q44 marksShow the complete working of DNS.

2075 Ashwin · Q38 marksWhat is DNS? Explain the DNS working mechanisms with suitable example.

2074 Ashwin · Q35 marksExplain the DNS working mechanism with suitable practical example.

2073 Shrawan · Q3a4 marksExplain Domain Naming Service (DNS) with its features.

2071 Chaitra · Q310 marksVerify with proper explanations that DNS is a distributed hierarchical database system.

DNS is the internet naming scheme that lets resources be accessed by alphanumeric names rather than addresses. It is a distributed hierarchical database, and each word of that is literal.

  • Database: it stores resource records and answers queries against them.
  • Hierarchical: the name space is a tree with an unnamed root, then top level domains, then second level domains, with a full stop as separator, read right to left from general to specific. Valid characters are A to Z, a to z, 0 to 9 and the hyphen.
  • Distributed: no server holds the whole database. It is divided into zones, each served by its own authoritative name servers run by whoever owns that part of the tree, and delegation is by NS records pointing at the servers of the zone below.
  • And it behaves as one system, since any client asking any resolver obtains the same answer.
Lecture note figure: a DNS lookup numbered one to eight, the client asking its local DNS server, which queries a root server, then the com server, then the authoritative server for the domain, and finally returns the address to the client

Working mechanism, resolving www.example.com.

  1. The client issues a DNS query for the address to its local DNS server.
  2. The local server, having no answer, queries a root name server.
  3. The root returns the address of the top level domain server for com.
  4. The local server queries the TLD server.
  5. The TLD server replies with the name and address of the authoritative server for the domain.
  6. The local server queries that authoritative server.
  7. It replies with the address of www.example.com.
  8. The local server returns the address to the client, which then requests the content directly.

Features: hierarchical partitioning into zones; delegation of authority; replication of every zone on at least two servers; caching of answers for the record's time to live, which removes most of the traffic above the local server; and resource records of several types: A for an address, CNAME for an alias, NS for an authoritative name server, MX for a mail exchanger, PTR for a reverse pointer and SOA for the start of authority.

MapReduce: components, data flow and fault tolerance PIN 3/22

Asked 6 times, in 3 papers

2068 Chaitra · Q88 marksDefine the components that make up a basic MapReduce job and illustrate with diagram how does the data flow through Hadoop MapReduce.

2068 Baishakh · Q78 marksDefine referential transparency with example. Explain mapreduce program execution flow.

2068 Baishakh · Q8b4 marksDiscuss fault tolerance of mapreduce jobs.

2067 Mangsir · Q511 marksDiscuss the main points that MR draws from referential transpareny in functional programming. With an example of your choice explain the MapReduce programming model.

2067 Mangsir · Q8b3 marksExplain any 3 of the following: External sort is related with MR programming model in Hadoop

2067 Mangsir · Q8c3 marksExplain any 3 of the following: Compression can improve the performance of MapReduce job

Components of a basic job.

  • Input format and input splits: the input is divided into splits, normally one per block, and one map task is started per split.
  • Mapper: reads records from its split and emits intermediate key and value pairs.
  • Combiner (optional): a local reducer run on a mapper's output to shrink it before the network transfer; valid only when the reduce is associative and commutative.
  • Partitioner: decides which reducer each key goes to, by default hash(key) mod R.
  • Shuffle and sort: the framework transfers every intermediate pair to its reducer and sorts by key.
  • Reducer: receives a key with the list of its values and emits the final output.
  • Output format: writes one output file per reducer.

Data flow: input file, splits, map, combine, partition, shuffle and sort, reduce, output files.

Example, word count. The map emits (word, 1) for every word of its split; the combiner adds the ones for each word locally; the partitioner sends each word to a reducer; the reducer sums the values for its word and emits (word, total).

Referential transparency means an expression can be replaced by its value without changing the program, because its result depends only on its arguments and it has no side effects. For example square(4) can always be replaced by 16. MapReduce requires map and reduce to be referentially transparent, and draws three things from it: a task may be scheduled on any machine, since it depends only on its input; a task may be re-executed after a failure with the same result; and two copies of a slow task may be run and the first result taken, which is speculative execution.

Fault tolerance. The master pings each worker; a worker that does not answer is marked failed. Completed map tasks on it are re-executed, because their output was on that machine's local disk; completed reduce tasks are not, because their output is in the distributed file system. In progress tasks of either kind are rescheduled. A task that fails repeatedly on the same record is skipped. If the master fails the job is restarted from its checkpoint.

Compression improves performance because a MapReduce job is bound by disk and network transfer, not by processor time. Compressing the map output shrinks what has to be written to local disk and shuffled across the network, and compressing the input and output shrinks the reads and writes, so the extra processor cost is repaid many times. The compression format must be splittable, or one file can no longer be divided into splits.

External sort is what the shuffle really is. The intermediate data is far larger than memory, so each mapper sorts its output in memory, spills sorted runs to disk, and the reducer merges the sorted runs it receives. That is exactly the classic external merge sort, which is why a MapReduce job can sort data far larger than the cluster's memory.

Remote procedure call and its operation HOT 4/22

Asked 4 times

2081 Bhadra · Q23 marksExplain the functional steps taken by modern RPC

2080 Bhadra · Q26 marksHow RPC operation is performed in client server communication in distributed system.

2076 Ashwin · Q10a4 marksWrite short notes on any two: RPC

2069 Chaitra · Q25 marksExplain the operation of RPC in client server communication in Distributed System.

Remote procedure call is a mechanism in which a client program calls a procedure in another program running in a server process, as if it were a local call. The server publishes a service interface naming the procedures available for remote calling. RPC carries no object references and cannot create new objects.

Lecture note figure: the ten functional steps of a remote procedure call, client functions down to client stub to network routines, across the network to the server's network routines, server stub and server functions, and the reply back along the same path

The functional steps:

  1. The client procedure calls the client stub in the normal way.
  2. The client stub builds the message, marshalling the procedure identifier and the arguments, and calls the local operating system.
  3. The client's operating system sends the message to the remote operating system.
  4. The remote operating system gives the message to the server stub.
  5. The server stub unpacks the parameters and calls the server procedure.
  6. The server does the work and returns the result to the stub.
  7. The server stub packs the result into a message and calls its local operating system.
  8. The server's operating system sends the message to the client's operating system.
  9. The client's operating system gives the message to the client stub.
  10. The stub unpacks the result and returns it to the client.

The stubs perform marshalling, converting arguments into an agreed external representation and back, which is what allows machines of different architectures to interoperate.

Static and dynamic RMI PIN 3/22

Asked 3 times

2081 Baishakh · Q28 marksDiscuss how dynamic RMI works.

2080 Baishakh · Q26 marksExplain the operation of dynamic RMI.

2071 Shrawan · Q25 marksWrite the operation of static RMI.

Static RMI. The remote interface is known when the client is compiled.

  1. The interface is written in an IDL or a Java interface and compiled, generating the proxy for the client and the dispatcher and skeleton for the server.
  2. The server creates the servant and registers it with the binder under a name.
  3. The client looks the name up in the binder and receives a proxy.
  4. The client calls a method on the proxy exactly as a local call; the compiler checks the call against the interface.
  5. The proxy marshals, the request travels, the skeleton unmarshals and invokes the servant, and the result returns.

It is fast and type checked, and it can invoke only interfaces known at compile time.

Dynamic RMI. The interface is discovered at run time, so no proxy class exists.

  1. The client obtains the remote object reference from the binder or naming service.
  2. It queries an interface repository for the methods that object offers and their parameter types.
  3. It builds the invocation as data: a list of arguments and the method name, assembled into a request at run time.
  4. It sends the request through the dynamic invocation interface, and the server side may use a dynamic skeleton interface to dispatch to an object whose type was not known when the server was written.
  5. The result is returned as a generic value and the client interprets it.

It is slower and not type checked, and it allows a client to invoke services that did not exist when it was written, which is what browsers of services and management tools need.

5Time and state

Lamport's logical clock TOP 9/22

Asked 10 times, in 9 papers

2081 Bhadra · Q42 marksList the basic principle of Lamport's clock

2081 Baishakh · Q48 marksDiscuss the principles of Lamport's clock with algorithm.

2078 Bhadra · Q56 marksWrite implementation rules of Lamport clock.

2076 Ashwin · Q55 marksExplain Lamport's logical clock with its pros

2075 Ashwin · Q11a3 marksWrite short notes on: Lamport's clock

2073 Shrawan · Q4b6 marksExplain Lamport's Logical clock.

2073 Shrawan · Q4b2 marksWhat do you mean by logical clock?

2072 Kartik · Q66 marksExplain how clock synchronization can be solved using logical clock.

2070 Ashad · Q56 marksDescribe Lamport's timestamp algorithm with its benefits

2069 Chaitra · Q56 marksExplain Lamport timestamp algorithm along with an example.

A logical clock is a monotonically increasing software counter that records the relative ordering of events, used when the order of events matters more than the physical time. Lamport's clock implements it from the happened before relation.

The happened before relation, written ab:

  • If a and b are events of the same process and a occurs first, then ab.
  • For any message m, send(m)receive(m).
  • If ab and bc, then ac.
  • If ab then a causally affects b; if neither ab nor ba holds, the events are concurrent, written ab.

Implementation rules. Each process Pi keeps a counter Ci:

  1. A process increments its counter before each event: Ci:=Ci+1.
  2. When a process sends a message, it includes its counter value t=Ci with the message.
  3. On receiving a message carrying t, the receiver sets its counter to be greater than the maximum of its own value and the received value before considering the message received: Cj:=max(Cj,t)+1.
Lecture note figure: two copies of the same three process message diagram stamped with Lamport clocks, the first showing a message that appears to arrive before it was sent and is marked impossible, the second with the receive clock corrected upward so causality holds

Example. In the figure, message C leaves a process whose clock reads 60 and reaches a process whose clock reads 56. Without rule 3 the receive would be stamped earlier than the send, which is impossible; rule 3 raises the receiver's clock to 61, so C(send)<C(receive) holds.

Benefits: it is simple, it costs one integer per process and one field per message whatever the size of the system, it needs no synchronised physical clocks, and it guarantees that if ab then C(a)<C(b), which is enough to build mutual exclusion and timestamp ordering.

Vector clocks HOT 5/22

Asked 5 times

2080 Bhadra · Q58 marks"Vector timestamp mechanism for synchronization is used for causality of events". Justify with the implementation rules and examples.

2080 Baishakh · Q46 marksExplain the importance of VECTOR clock with its implementation rules and example.

2076 Chaitra · Q48 marksHow do you avoid the issue? Explain with your alternate algorithm.

2075 Chaitra · Q54 marksHow vector clock is beneficial than Lamports clock? Explain with implementation rules of vector clock.

2074 Ashwin · Q56 marksExplain the clock synchronization algorithm using vector clock along with an example.

A vector clock gives the ability to decide whether two events are causally related simply by looking at their timestamps. For a system of N processes it is an array of N integers, and each process Pi keeps its own vector Vi. The entry Vi[i] counts the events of Pi itself, and Vi[j] is what Pi knows of the events of Pj.

Implementation rules.

  1. Initially all clocks are zero.
  2. On an internal event a process increments its own element of the vector by one.
  3. On sending a message a process increments its own element by one and sends its entire vector with the message.
  4. On receiving a message a process increments its own element by one and updates every element by taking the maximum of its own value and the value in the received vector.
Lecture slide: three process time lines with each event stamped by a three element vector clock, and the rules for comparing two vector timestamps for equality, less than and concurrency

Comparing two timestamps. For vectors u and v: u=v if every element is equal; uv if u[i]v[i] for every i; u<v if uv and uv; and u and v are concurrent if neither u<v nor v<u.

Justification that it captures causality. With vector clocks

abV(a)<V(b)

The implication runs both ways, which is exactly the property Lamport's clock lacks, so two events can be classified as causally related or concurrent from their timestamps alone.

Example. In the figure event c on P1 carries (3,0,0) and event g on P3 carries (0,0,1). Neither vector is less than or equal to the other, so the events are concurrent. Event f carries (2,4,1), which is greater than (2,0,0), so the second event of P1 causally precedes it.

Cost. The storage and the message payload are proportional to the number of processes, which is the price paid for detecting causality.

Cristian's algorithm PIN 3/22

Asked 3 times

2076 Chaitra · Q9c3 marksWrite short notes on: Physical Clock Synchronization: Cristain's Algorithm

2072 Chaitra · Q56 marksDescribe a method for physical clock synchronization.

2072 Kartik · Q9a3 marksWrite short notes on: Christian's Algorithm

Cristian's algorithm is an external physical clock synchronisation method. It relies on a time server S whose clock is held accurate by a radio clock or another UTC source, and every other computer synchronises by making a procedure call to it.

Lecture note figure: Cristian's algorithm on a time line, the client sending a request at T zero, the time server handling the interrupt and stamping the UTC time, and the reply arriving back at the client at T one, both measured on the client's own clock

Algorithm, between a process P and the time server S:

  1. P requests the time from S, noting T0 on its own clock.
  2. S prepares a response and appends the time T from its own clock.
  3. P receives the reply at T1 and sets its clock to T+RTT/2, where RTT=T1T0.

The method assumes the round trip is split equally between request and response, which is reasonable on a local network. Accuracy is improved by making several requests and using the reply with the shortest round trip.

Accuracy. If min is the minimum one way transmission time, the time at S when P reads the reply lies between T+min and T+RTTmin. The width of that range is RTT2min, so the accuracy is ±(RTT/2min).

Example. Request sent at 5:08:15.100, reply received at 5:08:15.900, reply contains 5:09:25.300. The round trip is 800 ms, so the timestamp was made about 400 ms ago, and the clock is set to 5:09:25.700 with accuracy 400 ms.

Drawback. If the time server fails, synchronisation is impossible, so the time should be provided by a group of synchronised time servers.

Network Time Protocol PIN 3/22

Asked 3 times

2080 Bhadra · Q10d4 marksWrite short notes on: NTP

2075 Ashwin · Q62 marksWhat is Network Time Protocol (NTP)?

2070 Chaitra · Q62 marksExplain Network Time Protocol

NTP defines an architecture that enables clients across the internet to be synchronised accurately to UTC, by synchronising against many time servers rather than one.

Design aims: adjust the system clock close to UTC over the internet; handle bad connectivity; enable frequent resynchronisation; and provide security against a false time source.

Lecture note figure: the NTP synchronisation subnet as three strata, stratum one servers connected directly to atomic clocks, stratum two servers synchronised from them, and stratum three below that, with peer links drawn between servers of the same stratum

Hierarchical structure. NTP is provided by a network of servers across the internet. Primary servers are connected directly to a time source and secondary servers synchronise with them. The logical hierarchy is the synchronisation subnet and each of its levels is a stratum; the lowest level executes in the user's workstation, and servers with higher stratum numbers have less accurate clocks. The subnet reconfigures when a server fails.

Three modes of synchronisation.

  • Multicast mode: a server periodically multicasts the time to the others, which set their clocks assuming a small delay.
  • Procedure call mode: a server accepts requests from other computers and replies with its timestamp.
  • Symmetric mode: a pair of servers on the higher levels exchange messages continually to improve the accuracy of their synchronisation over time.

Computing the offset. A sends at T1, B receives at T2, B replies at T3 carrying both values, and A receives at T4. The total transit time is d=(T4T1)(T3T2), and assuming the two directions are equal the offset between the clocks is

o=(T2T1)+(T3T4)2

NTP keeps the last eight pairs of offset and delay and uses the offset whose delay was smallest.

Berkeley's algorithm PIN 2/22

Asked 2 times

2075 Ashwin · Q64 marksHow Berkeley minimizes the problems of single time server failures of Chistian's algorithm.

2070 Chaitra · Q62 marksBerkeley Algorithm for physical clock synchronization.

Berkeley's algorithm is an internal synchronisation algorithm for a system with no radio clock, so there is no way to obtain real time. It maintains a global average as the global time.

Lecture slide: the Berkeley algorithm in three steps, the time daemon polling every machine for its time, the machines replying with their clock values, and the daemon telling each one how much to adjust its clock by
  1. One computer is chosen as the master; the rest are slaves.
  2. The master periodically polls the slaves for their time, and they send back their clock values.
  3. The master estimates each slave's local time by observing the round trip times.
  4. The master calculates the average of the values obtained, including its own.
  5. While averaging it eliminates faulty clocks, by choosing a subset of clocks that do not differ from one another by more than a specified amount.
  6. The master sends each slave the amount by which it should adjust its clock, which may be positive or negative.
  7. If the master fails, one of the slaves is elected to take its place.

How this minimises the single time server problem of Cristian's algorithm. Cristian's algorithm depends on one server that alone holds the correct time, so its failure stops synchronisation altogether and a wrong reading from it is accepted without question. In Berkeley's algorithm no machine is the source of truth: the time is the average of all of them, a clock that differs too much is excluded from that average, and if the master itself fails a slave is elected to replace it, so the system keeps synchronising.

The Chandy and Lamport snapshot algorithm PIN 2/22

Asked 2 times

2079 Bhadra · Q86 marksExplain snapshot algorithm used for backward recovery in distributed system.

2071 Shrawan · Q45 marksWrite Chandy-Lamport's algorithm for recording global states in Distributed System.

The algorithm records a consistent global state while the processes continue their normal work, by circulating a special marker message that separates the messages belonging to the snapshot from those that do not. The recorded state is used as a checkpoint for backward recovery.

Assumptions.

  1. Communication is reliable, so every message sent is eventually received exactly once.
  2. Channels are unidirectional and provide FIFO ordered message delivery.
  3. The graph of processes and channels is strongly connected.
  4. Any process may initiate a global snapshot at any time.
Lecture slide: a process receiving a marker for the first time, recording its local state, sending markers out on all its outgoing channels and starting to record the messages arriving on its other incoming channels

Marker receiving rule for process Pi, on receipt of a marker over channel c:

  • If Pi has not yet recorded its state: it records its process state; it records the state of c as the empty set; and it turns on the recording of messages arriving over its other incoming channels.
  • Otherwise: it records the state of c as the set of messages it has received over c since it recorded its state.

Marker sending rule for process Pi: after Pi has recorded its state, for each outgoing channel c, it sends one marker message over c before it sends any other message over c.

Why the result is consistent. Because channels are FIFO and the marker precedes every later message, no message can be recorded as received unless its send has also been recorded, which is the definition of a consistent global state. The algorithm terminates when every process has received a marker on every incoming channel, and the pieces are then collected into one snapshot.

Causal ordering of messages using vector clocks PIN 1/22

Asked once

2079 Bhadra · Q46 marksHow is casual ordering of message realized using vector clocks?

Causal ordering requires that if send(m1)send(m2), then every process receiving both delivers m1 before m2. Without it a reply can be delivered before the message it answers.

Lecture slide: three process time lines with vector timestamps on every message, showing a message that must be delayed at the receiver until the message it causally depends on has been delivered

Basic idea. A message is delivered to a process only if the message immediately preceding it in the causal ordering has already been delivered; otherwise the message is buffered. Arrival and delivery are separate events, and the protocol lives in the gap between them. Processes are assumed to communicate by broadcast.

Implementation. The vector clocks are incremented only for message sending, so Vi[j] counts the messages Pi has seen from Pj.

  1. Before broadcasting a message m, process Pi increments Vi[i] by one, and the timestamp tm carried by m is Vi.
  2. On the receiving side, Pj delays the delivery of m from Pi until both conditions hold:
    • tm[i]=Vj[i]+1, so this is the next message expected from Pi and none has been missed;
    • tm[k]Vj[k] for every ki, so Pj has already received every message that Pi had received before sending this one.
  3. Delayed messages are queued at each process and ordered by their vector timestamps, so concurrent messages are delivered in the order they arrived.
  4. When the message is delivered, Pj updates its vector clock by the usual receiving rule.

6Coordination and agreement

The Byzantine generals problem HOT 6/22

Asked 7 times, in 6 papers

2081 Baishakh · Q62 marksWhat is byzantine problem?

2080 Bhadra · Q94 marksHow to achieve agreement in faulty system over reliable channel? Explain.

2075 Chaitra · Q93 marksWhat do you learn from Byzantine generals problem?

2071 Chaitra · Q74 marksExplain Byzantine general problem to handle faulty process with example.

2070 Chaitra · Q102 marksWhat do you mean by Byzantine Failure?

2070 Chaitra · Q105 marksExplain Byzantine Generals problem to illustrate how agreement can be reached in faulty system.

2070 Ashad · Q94 marksHow to come agreement in faulty system? Explain with the approach of byzantine generals problem.

A Byzantine failure is an arbitrary failure: the process does not stop, it behaves wrongly, possibly maliciously, sending different or false values to different peers. The Byzantine generals problem is the agreement problem under such failures.

The problem. Three or more generals must agree to attack or to retreat. One, the commander, issues the order; the others, the lieutenants, must decide. One or more generals may be treacherous, and a traitor may tell one lieutenant to attack and another to retreat. It differs from plain consensus because a single process supplies the value to agree on.

Requirements: termination, every correct process decides; agreement, all correct processes decide the same; integrity, if the commander is correct then all correct processes decide the commander's value.

Lecture slide: the impossibility result with three byzantine generals, a commander sending conflicting orders to two lieutenants who cannot tell which of the other two is lying

Impossibility with three generals. The commander tells lieutenant 1 to attack and lieutenant 2 to retreat, and each lieutenant reports what it heard to the other. Lieutenant 1 now holds two contradictory values and cannot tell whether the commander lied or lieutenant 2 did, and a majority of two conflicting values does not exist, so no rule can decide correctly in both cases.

Lecture slide: the solution with four byzantine generals, where each lieutenant forwards what it received to the others and the majority of the three reported values gives the correct order

Solution with four generals, one commander and three lieutenants with at most one traitor:

  1. The commander sends its value to each of the three lieutenants.
  2. Each lieutenant forwards the value it received to the other two lieutenants.
  3. Each lieutenant now holds three values, the commander's and two reports, and takes the majority of them.

If the commander is correct, all three lieutenants received the same value, so the majority is that value whatever the traitor reported. If the commander is the traitor, the three correct lieutenants each hold the same three values, so their majorities agree with one another, which is what agreement requires.

The result. A solution exists if and only if fewer than one third of the processes are faulty: with f faulty processes at least 3f+1 processes are needed, and the algorithm takes f+1 rounds.

What it establishes: agreement is still possible when participants lie, but only while they are a small enough minority; the cost in messages and rounds is high; and redundancy alone is not sufficient, because it is the ratio of faulty to correct processes that decides whether agreement can be reached.

Ricart-Agrawala algorithm HOT 5/22

Asked 5 times

2079 Bhadra · Q56 marksExplain ricart-agrawala token based algorithm.

2078 Bhadra · Q65 marksExplain the various state of Ricart Agrawala token based mutual exclusion.

2075 Ashwin · Q76 marksExplain non token based Ricart-Agrawala mutual exclusion algorithm along with an example.

2074 Ashwin · Q64 marksand Ricart Agrawala algorithm with example and compare them.

2072 Chaitra · Q66 marksExplain the non-token based distributed mutual exclusion algorithm

The Ricart-Agrawala algorithm is an extension and optimisation of Lamport's algorithm. It uses only two message types, REQUEST and REPLY, and assumes FIFO channels. Requests carry a Lamport timestamp, and a smaller timestamp has higher priority.

Lecture slide: the Ricart and Agrawala distributed algorithm in three panels, two processes requesting the critical section at once, the one with the smaller timestamp being allowed in while the other defers its reply, and the reply being sent when the first leaves

To enter the critical section.

  • Site Si sends a timestamped REQUEST to all other sites.
  • Site Sj receiving it sends a REPLY if and only if Sj is neither requesting nor executing the critical section, or Sj is requesting but the timestamp of Si's request is smaller than its own. Otherwise the request is deferred.

To execute. Si enters when it has received a REPLY from all other sites.

To release. On exiting, Si sends a REPLY to all the requests it had deferred. The deferred reply replaces Lamport's release message, which is what saves a third of the traffic.

The three states of a site are: not requesting, in which every incoming request is replied to at once; requesting, in which an incoming request is replied to only if its timestamp is smaller, and is otherwise deferred; and executing, in which every incoming request is deferred.

Example. Sites 1 and 2 both want the critical section. Site 1 sends (8,1) and site 2 sends (12,2) to everybody. Site 3, which is not interested, replies to both. Site 2 compares 12 with the incoming 8, finds its own request later, and replies to site 1. Site 1 compares 8 with the incoming 12, finds its own request earlier, and defers. Site 1 now has replies from both others and enters. On leaving, site 1 sends the deferred reply, and site 2 then has both replies and enters.

Cost: 2(N1) messages per entry, that is N1 requests and N1 replies.

Consensus and how it is achieved HOT 5/22

Asked 5 times

2079 Bhadra · Q54 marksExplain with example how can you achieve consensus in distributed system.

2078 Bhadra · Q83 marksDiscuss how Consensus can be achieved in Distributed System.

2076 Chaitra · Q55 marksHow to come to consensus in DS? Explain.

2071 Shrawan · Q63 marksHow to come to consensus in DS?

2070 Ashad · Q63 marksDiscuss with steps how consensus can be achieved in Distributed System.

In the consensus problem every process begins undecided and proposes a value; the processes exchange messages and each eventually sets a decision variable and enters the decided state, after which the value cannot change.

Requirements: termination, every correct process eventually decides; agreement, all correct processes decide the same value; and integrity, if all correct processes proposed the same value then that is the value decided.

Textbook figure: consensus for three processes, two proposing to proceed and one proposing to abort before crashing, with the two surviving processes deciding to proceed

How it is achieved in a synchronous system that tolerates up to f crash failures, in f+1 rounds:

  1. Each process holds a set of values, initially containing only its own proposal.
  2. In each round, every process multicasts the values it has newly obtained to all the others, and adds every value it receives to its set.
  3. After f+1 rounds each process applies the same deterministic function to its set, for example taking the minimum, and that is its decision.

Why f+1 rounds are enough: at most f processes can fail, so at least one of the f+1 rounds is free of failures, and in that round every process receives every value the others hold. Their sets are then identical, and the same function on the same set gives the same answer.

Example. Three processes propose proceed, proceed and abort, and the third crashes during the first round after telling only one other process. In the second round the process that heard abort passes it on, so both survivors hold the same set and both decide the same value.

The limit. By the Fischer, Lynch and Paterson result of 1985, no consensus algorithm can be guaranteed to terminate in an asynchronous system if even one process may crash, because a crashed process cannot be distinguished from a slow one. Practical systems therefore use failure detectors and timeouts to approximate synchrony, or accept algorithms such as Paxos that are always safe and only eventually live.

The Bully election algorithm HOT 4/22

Asked 4 times

2081 Bhadra · Q54 marksExplain the functional steps of anyone election algorithm.

2071 Chaitra · Q44 marksExplain BULLY algorithm with suitable example.

2070 Ashad · Q65 marksExplain any one election technique in Distributed System.

2069 Chaitra · Q64 marksExplain an election algorithm with example that is suitable to your scenario.

The Bully algorithm dynamically selects a coordinator by process identifier: the surviving process with the highest identifier wins, and a higher numbered process that recovers will bully a lower numbered coordinator out of the position, which is where the name comes from.

Assumption: the system is synchronous and uses timeouts to identify process failure, and every process knows the identifiers of the others.

Message types: Election, to announce an election; Answer, in response to an election message; and Coordinator, to announce the identity of the elected process.

Steps.

  1. A process that notices the coordinator is not responding sets its state to election in progress and sends an election message to every process with a higher identifier.
  2. Every higher process that receives it replies with an answer message, telling the initiator to stop, and then starts an election of its own.
  3. If the initiator receives no answer before its timeout, it is the highest surviving process; it becomes the coordinator and sends a coordinator message to all processes.
  4. If it did receive an answer, it waits for a coordinator message, and restarts the election if none arrives before a further timeout.
Lecture note figure: the first three steps of the bully algorithm, process four sending election messages to the higher numbered processes, processes five and six answering to stop it, and five and six each holding their own election Lecture note figure: the last two steps of the bully algorithm, process six telling five to stop, and process six winning and sending a coordinator message to every other process

Example with processes 0 to 7, where 7 was the coordinator and has crashed. (a) Process 4 notices and sends election messages to 5, 6 and 7. (b) Processes 5 and 6 answer, so 4 stops. (c) Processes 5 and 6 now each hold their own election, messaging the higher numbers. (d) Process 6 answers 5, so 5 stops. (e) Process 6 hears from nobody higher, so it wins and sends a coordinator message to all the others.

Cost. In the best case the process with the second highest identifier notices the failure, finds nobody above it and sends N2 coordinator messages. In the worst case the process with the lowest identifier starts, sending N1 election messages to processes that each start their own election, which costs O(N2) messages.

Electing a new central coordinator PIN 3/22

Asked 3 times

2080 Bhadra · Q66 marksExplain the steps to elect coordinator in process resilience system.

2079 Bhadra · Q9c3 marksWrite short notes on: Coordinator election process in central coordinator algorithm

2076 Chaitra · Q55 marksHow does a new coordinator elect in executing central coordinator algorithm?

The central coordinator is a single point of failure, so when it crashes the surviving processes must choose a new one. The election is normally the Bully algorithm, and the coordinator is the process with the highest identifier.

  1. A process notices, through a timeout on its request, that the coordinator is not responding.
  2. It sets its state to election in progress and sends an election message to every process with a higher identifier.
  3. Any higher process that receives it replies with an answer message, which tells the initiator to stop, and then starts an election of its own.
  4. If the initiator receives no answer before its timeout, it is the highest surviving process, so it becomes the coordinator and sends a coordinator message to every process.
  5. If it did receive an answer, it waits for a coordinator message; if none arrives before a second timeout, it restarts the election.
  6. Every process records the new coordinator and sends its pending requests to it. The new coordinator starts with an empty queue, so processes that were waiting must request again.

When a crashed process with a high identifier recovers, it holds an election of its own and takes the coordinator role back, which is how the algorithm gets its name.

Token based mutual exclusion PIN 2/22

Asked 3 times, in 2 papers

2075 Chaitra · Q62 marksHow token system works for mutual exclusion in Distributed System.

2075 Chaitra · Q66 marksExplain with token based Algorithm.

2071 Shrawan · Q56 marksWrite alternate algorithm to address those performance issues.

A single token represents the right to use the shared resource. It is passed among the processes in a regulated way, and a process may enter its critical section only while it holds the token, so safety is automatic: one token means one process inside.

Lecture note figure: the three states of a process in the token based algorithm, no token, token held and token present, with the transitions between them labelled by what causes each one

Ricart-Agrawala token algorithm. A process that wants the token sends a request to all the other processes, carrying its logical clock timestamp and its identifier. The token is given arbitrarily to one process at the start. Each process Pi records in request[j] the timestamp of the last request received from Pj, and the token carries token[j], the timestamp of Pj's last holding of it; so Pj has a pending request exactly when request[j]>token[j].

  1. Initialisation: every process is in state NO-TOKEN except one, which is TOKEN-PRESENT, and all entries of token[] and request[] are zero.
  2. Requesting: if the process has no token it sends a request (TPi,i) to all processes and waits until the token arrives; it then becomes TOKEN-HELD and enters. If it already holds the token it enters immediately, with no messages at all.
  3. Handling an incoming request (TPj,j): set request[j]:=max(request[j],TPj), and if this process is TOKEN-PRESENT, release the resource.
  4. Releasing: search k in the order [i+1,i+2,,n,1,,i1]; for the first k with request[k]>token[k], set token[i] to the local clock, become NO-TOKEN and send the token to Pk. If no process is waiting, retain the token.

Advantages: it requires only N1 requests and one reply, the failure of a process that is not holding the token does not prevent progress, and repeated entry by the token holder is free.

Central coordinator algorithm PIN 2/22

Asked 2 times

2081 Baishakh · Q8b5 marksWrite short notes on: Center coordinator algorithm and its issues

2074 Ashwin · Q64 marksDescribe non-token based centralized

A single central coordinator grants permission to enter the critical section, and a process that wants to enter must take permission from it. It is simple to implement and needs only three messages per use of the critical section: request, OK and release.

Lecture note figure: the central coordinator algorithm in three panels, process one requesting and being granted the critical section, process two requesting and being queued, and process one releasing so the queued request is granted
  1. To enter the critical section, a process sends a request message to the coordinator and waits for a reply; while waiting it may continue with other work.
  2. The reply from the coordinator gives the right to enter. If the critical section is busy, the coordinator sends no reply and places the request on a queue.
  3. After finishing, the process notifies the coordinator with a release message, and the coordinator replies to the request at the head of its queue.

Advantages: easy to implement; only three messages per access; and fair, because the queue preserves the order of arrival.

Issues:

  • The performance of the system may degrade, because every request passes through one machine, which becomes a bottleneck.
  • The coordinator is a single point of failure, and if it crashes a new coordinator must be created using an election algorithm.
  • A requesting process cannot distinguish a dead coordinator from a coordinator that is merely busy, since both look like silence.

Token ring algorithm PIN 2/22

Asked 2 times

2073 Shrawan · Q66 marksExplain how token ring algorithm works for mutual exclusion in DS.

2071 Chaitra · Q610 marksExplain with algorithmic steps, how token ring algorithm works for mutual exclusion in distributed system.

The n processes are arranged in a logical ring, in which each process knows only its clockwise neighbour; the physical network need not be a ring at all.

Lecture note figure: n processes P1 to Pn arranged in a logical ring, each with one neighbour clockwise

Algorithmic steps.

  1. The token is initially given to one process.
  2. The token circulates round the ring, each process passing it to its clockwise neighbour.
  3. When a process needs to enter the critical section, it waits until the token arrives from its left neighbour and retains it.
  4. It enters the critical section, and no other process can, because there is only one token.
  5. After leaving the critical section it passes the token on to its neighbour in the clockwise direction.
  6. If a process receives the token but does not need the critical section, it passes it along immediately.

Correctness. Safety holds because exactly one token exists. Liveness holds because the token visits every process in turn, so a waiting process waits at most one full circuit, which bounds the delay at N1 hops.

Problems.

  • It adds load to the network, because the token must be passed even when no process wants the critical section.
  • If one process fails, no progress is possible until the faulty process is removed from the ring and the ring is repaired.
  • If the process holding the token fails, the token is lost, so an election must be held to choose a process to generate a new one.
  • A duplicated token would break mutual exclusion, so token regeneration must be done carefully.

The ring based election algorithm PIN 2/22

Asked 2 times

2080 Baishakh · Q56 marksExplain the Ring Based election algorithm with rules and example.

2071 Chaitra · Q42 marksCompare it with Ring based algorithm.

The Chang and Roberts ring based algorithm finds the process with the largest identifier in a logical or physical ring. It works for any number of processes and does not require any process to know how many there are.

Lecture slide: an election in a ring, the election message travelling clockwise collecting process identifiers, and the coordinator message going round announcing the highest one

Rules.

  1. Initially every process has its flag set to non participant.
  2. A process that notices the lack of a leader starts an election: it creates an election message containing its own UID and sends it clockwise to its neighbour.
  3. A process that sends or forwards an election message sets its own flag to participant.
  4. On receiving an election message a process compares the UID in it with its own:
    • if the UID in the message is larger, it forwards the message unchanged;
    • if the UID is smaller and the process is not yet a participant, it replaces the UID with its own and forwards it;
    • if the UID is smaller and the process is already a participant, it discards the message;
    • if the UID is the same as its own, that process becomes the leader.
  5. The leader sets its own flag back to non participant and sends an elected message round the ring with its UID. Each process receiving it sets its flag to non participant, records the elected UID and forwards it. When it returns to the leader, the leader discards it and the election is over.

Example. Six processes are in a ring and process 6, the leader, fails. Process 3 notices and sends an election message with its id. Processes 5, 0, 1 and 4 each forward it, replacing the id when their own is larger, so the largest surviving id travels round. When the message carrying 5 returns to 5, process 5 becomes the leader and sends the coordinator message round, which each process forwards until it returns and is discarded.

Cost: about 2N+N/2 messages in the average case and 3N1 in the worst case.

PointBullyRing based
TopologyFully connectedA logical ring
Knowledge neededEvery process must know who is higher than itselfOnly its neighbour
MessagesO(N2) in the worst case3N1 in the worst case
AssumptionSynchronous, with timeoutsReliable FIFO ring, no timing assumption
Failure during electionHandled by timeout and restartBreaks the ring, which must be repaired

Reliable multicast and its properties PIN 2/22

Asked 2 times

2076 Ashwin · Q68 marksExplain reliable multicast with its properties and an algorithm.

2067 Mangsir · Q8a3 marksExplain any 3 of the following: Use of multicast communication in Distributed systems

Multicast sends one message to every member of a group. It is used in a distributed system for replication, so every replica manager receives the same update; for fault tolerance, so a request reaches a group of servers rather than one; for discovery, so a client can find services without knowing their addresses; and for event notification, so interested parties are informed of a change.

Basic multicast (B-multicast) simply sends the message to every member, usually by a loop of reliable one to one sends. It fails if the sender crashes part way through, leaving some members with the message and others without it.

Reliable multicast (R-multicast) requires three properties:

  • Integrity: a correct process delivers a message at most once, and only if it was actually sent to the group.
  • Validity: if a correct process multicasts a message, it will eventually deliver it itself.
  • Agreement: if a message is delivered to one correct process, then all correct processes in the group will deliver it.

The algorithm.

  1. On initialisation each process sets Received:={}.
  2. To R-multicast a message m to group g, a process B-multicasts m.
  3. On B-delivering m, a process tests whether m is already in Received. If it is, the message is discarded, which gives integrity. If not, the process adds m to Received, B-multicasts m again itself unless it was the original sender, and then R-delivers m.

The re-multicast is what provides agreement: if any correct process delivered the message it has also forwarded it to every other member, so the sender's failure cannot leave a member without it. The cost is that every message is transmitted about N times, which is why practical systems use negative acknowledgements instead.

Lamport's mutual exclusion algorithm PIN 1/22

Asked once

2070 Chaitra · Q76 marksExplain the way how Lamport algorithm ensures mutual exclusion?

Lamport's algorithm is permission based. Critical section requests are executed in increasing order of timestamp taken from Lamport's logical clock, so a smaller timestamp has higher priority. It uses three message types, REQUEST, REPLY and RELEASE, assumes FIFO channels, and every site keeps its own request queue ordered by timestamp.

To enter the critical section.

  • When site Si wants to enter, it sends REQUEST(tsi,i) to all other sites and places the request on its own queue.
  • When site Sj receives that request, it returns a timestamped REPLY to Si and places Si's request on its own queue.

To execute the critical section. Si may enter when it has received a message with a timestamp larger than (tsi,i) from every other site, and its own request is at the top of its queue.

To release the critical section. Si removes its own request from the top of its queue and sends a timestamped RELEASE to all other sites; each site receiving it removes Si's request from its queue.

How this ensures mutual exclusion. Every site holds the same set of requests ordered by the same rule, timestamp first and process identifier to break ties, so all sites agree on which request is at the top. A site may enter only when its own request is at the top of its queue and it has heard from everybody with a later timestamp, so no two sites can believe they are first at the same time. The cost is 3(N1) messages per entry.

7Replication

Active replication HOT 5/22

Asked 5 times

2081 Baishakh · Q8c5 marksWrite short notes on: Active replication technique in DS

2078 Bhadra · Q74 marksExplain active replication model in fault tolerance.

2075 Chaitra · Q76 marksExplain the active replication model with its advantages and disadvantages.

2074 Ashwin · Q75 marksExplain working mechanism of active replication.

2072 Chaitra · Q75 marksExplain active replication model with its advantages and disadvantages.

In active replication every replica sees exactly the same set of messages in the same order and processes them in that order. The replica managers are state machines playing equivalent roles, so it is also called the state machine approach. It assumes the objects are deterministic and requires a group communication mechanism that delivers the same messages to every replica in the same order.

Lecture slide: the active model, front ends multicasting each request to a group of three replica managers, each of which processes it independently and replies

Working mechanism, in the five phases.

  1. Request: the front end attaches a unique identifier and totally ordered reliable multicasts the request to the group of replica managers.
  2. Coordination: the group communication system delivers the request to every replica manager in the same total order.
  3. Execution: every replica manager executes the request; being deterministic and starting from the same state, they all reach the same new state.
  4. Agreement: no agreement phase is needed, because the total ordering has already provided it.
  5. Response: each replica manager sends its response to the front end, which takes the first, or compares several if it wishes to detect a wrong answer.

Advantages.

  • Every server can respond to client queries with up to date data.
  • Immediate failover: a replica failing is invisible, since the others already hold the answer, so there is no recovery pause.
  • It can tolerate Byzantine failures, because the front end can collect responses and take the majority.

Disadvantages.

  • Waste of resources, since every replica does the same work, so n machines give the write throughput of one.
  • It propagates updates only, which requires determinism: an operation that depends on a local clock, a random value or thread scheduling makes the replicas diverge.
  • It depends on totally ordered multicast, which is expensive and is itself a consensus problem.

Passive replication, the primary backup model HOT 4/22

Asked 4 times

2080 Baishakh · Q65 marksHow does a primary-backup model work?

2079 Bhadra · Q64 marksExplain how passive replication model supports in fault tolerance.

2076 Chaitra · Q64 marksHow to implement primary-backup replica system?

2070 Chaitra · Q85 marksExplain primary backup model for fault tolerance.

In passive replication, also called the primary backup model, one server plays a special primary role: it performs all the updates, maintains the most up to date state, and propagates the updates to the backup replicas eagerly or lazily. The backups may take some of the read load.

Lecture slide: the passive model, two clients each with a front end, both communicating with one primary replica manager which updates the two backup replica managers

Working, in the five phases.

  1. Request: the front end sends the request, carrying a unique identifier, to the primary replica manager only.
  2. Coordination: the primary takes requests in the order they arrive, and checks the identifier so that a repeated request is answered from its stored reply rather than executed again.
  3. Execution: the primary executes the request and stores the response.
  4. Agreement: for an update, the primary sends the new state, the response and the identifier to all the backups, and each backup acknowledges.
  5. Response: the primary replies to the front end, which returns the result to the client.

How it supports fault tolerance. If a backup fails nothing is lost, since it holds no unique state. If the primary fails, a surviving backup is elected as the new primary and takes over with the state of the last update it received, so the service continues. The surviving replica managers must first agree on which operations the old primary had completed, which is why view synchronous group communication is used.

Failure cases, against the six steps request, do work, update, do work at the backup, acknowledge, reply. If the primary crashes before doing the work, no harm is done. If it crashes after the work but before the update, the work is done a second time by the backup. If it crashes after the update but before the reply, the work may be done three times. Operations should therefore be idempotent or identified so duplicates can be filtered.

Three kinds of failover: cold, where the backup restarts the applications and any work in progress is lost; warm, where applications write periodic checkpoints that the backup reads to resume; and hot, where the backup runs in lockstep on the same inputs and is already in the primary's state when it takes over.

Highly available services and the gossip architecture HOT 4/22

Asked 4 times

2081 Bhadra · Q65 marksHow do Gossip Architecture avoid issues of active and passive replication? Explain.

2075 Ashwin · Q85 marksDiscuss with a technique that make the distributed system highly available.

2071 Shrawan · Q65 marksDiscuss with an approach, how do you make the distributed system service highly available?

2069 Chaitra · Q72 marksAlso discuss with a technique that make the distributed system service highly available.

A fault tolerant service keeps giving correct answers, so the replicas must agree before replying and the client waits. A highly available service gives an answer whenever the client asks, using whatever replicas are reachable, and accepts that the answer may be slightly out of date. The standard technique is the gossip architecture.

Lecture slide: the gossip architecture, clients sending queries and updates to front ends that carry vector timestamps, and replica managers exchanging gossip messages among themselves to spread updates lazily

How it works. A front end sends a query or an update to any available replica manager, normally the nearest. The replica manager replies to an update immediately, before the update has reached anywhere else, and the replica managers exchange gossip messages lazily among themselves to bring each other up to date.

Its two guarantees. Each client obtains a consistent service over time, so it never sees data older than what it has already seen, even after moving to another replica manager; and the replicas are eventually consistent, since all replica managers eventually receive all updates and apply them in an order that respects causality.

How the guarantee is enforced. Each front end keeps a vector timestamp reflecting the latest values it has seen, and sends it with every request. A replica manager that has not yet received those updates holds the request back until gossip supplies them. Clients that communicate directly piggyback their vector timestamps, which are then merged, so causal order is preserved outside the service as well.

How this avoids the issues of active and passive replication. Active replication makes every client wait for a totally ordered multicast to the whole group, and passive replication makes every client wait for a single primary and pause for an election when it fails; both therefore become unavailable exactly when the network is slow or partitioned. Gossip accepts the operation at any single replica manager and returns at once, so a distant or partitioned client is still served, and it needs neither determinism nor a primary. The price is that other clients may not see the update immediately, and the vector timestamps are what stop that staleness from becoming incoherent.

Electing the replica manager in primary backup replication PIN 1/22

Asked once

2081 Baishakh · Q510 marksHow do you elect replica manager in primary backup replication? Explain.

In the primary backup model exactly one replica manager is the primary, so when it fails the surviving replica managers must agree on a single replacement. Electing two would corrupt the state and electing none would stop the service.

  1. Detection. The backups monitor the primary, normally by periodic liveness probes or by heartbeats. When several successive messages go unacknowledged, a backup suspects the primary has failed. In an asynchronous system this can only ever be a suspicion, since a slow primary looks the same as a dead one.
  2. Election. The suspecting backup starts an election algorithm over the surviving replica managers. With the Bully algorithm it sends an election message to every replica manager with a higher identifier; any of them answers and takes over the election; the highest surviving identifier hears nothing above it and declares itself, sending a coordinator message to the others. With a ring algorithm the identifier is passed round until the largest one returns to its owner.
  3. View change. The surviving replica managers must agree on the new view, the set of members now alive, and agree on which operations the failed primary had completed. View synchronous group communication is used so that every survivor delivers the same set of messages before the view changes.
  4. State recovery. The new primary takes the state of the last update it received. Any request the old primary executed but did not propagate is lost, so a front end that does not receive a reply retransmits, and the identifier check in the coordination phase prevents the operation being applied twice.
  5. Resumption. The new primary announces itself to the front ends, which redirect their requests to it, and a new backup is started to restore the degree of replication.

The requirement that makes it correct is that the election must produce a unique leader that every survivor recognises. If the network partitions, a majority rule must be used, so that a minority partition cannot elect a second primary and accept updates in parallel.

8Transactions and concurrency control

Distributed deadlock, detection and avoidance TOP 9/22

Asked 9 times

2081 Baishakh · Q8a5 marksWrite short notes on: Distributed Deadlock and its avoidance approaches

2080 Bhadra · Q84 marksWhat are the solutions to avoid deadlock in distributed system?

2076 Chaitra · Q88 marksWhat are the alternative approaches to avoid possibility of deadlock in distributed system? Explain.

2076 Ashwin · Q85 marksWhat is a deadlock and what are phantom deadlocks.

2075 Chaitra · Q10b4 marksWrite short notes on: Distributed deadlock

2074 Ashwin · Q10a4 marksWrite short notes on: Distributed deadlock and recovery

2073 Shrawan · Q86 marksDiscuss the methods of distributed deadlock avoidance.

2071 Chaitra · Q83 marksWhat situation does lead to distributed deadlock?

2069 Chaitra · Q82 marksWhat do you mean by Distributed Deadlock?

A distributed deadlock is a state in which each member of a group of transactions spread over several servers is waiting for a lock held by another member, so none can proceed. The situation that leads to it is a circular wait whose edges lie at different servers: transaction T holds an object at server 1 and waits for one at server 2, while U holds the object at server 2 and waits for the one at server 1. Neither server can see the cycle, because each holds only part of the wait for graph.

Lecture note figure: local wait for graphs held at two sites, each showing processes waiting on one another plus an external node, with a cycle that appears only when the two graphs are combined

The four necessary conditions are mutual exclusion, hold and wait, no preemption and circular wait. Two kinds occur: resource deadlock, where each process waits for a resource held by another, and communication deadlock, where each waits to receive a message from another.

Detection uses a wait for graph and looks for cycles; when one is found a transaction is chosen as the victim and aborted, which is the recovery step. The control may be:

  • Centralized: each site keeps a local graph and one coordinator builds the global one from their replies; a cycle in the constructed graph means deadlock. It is simple, and it is a bottleneck and a single point of failure.
  • Hierarchical: the sites form a tree, each non leaf node holds information about its dependants, and a deadlock is detected by the lowest common ancestor of the conflicting sites.
  • Distributed: every site shares the responsibility, and detection is started when a process is suspected of being deadlocked. It has no single point of failure and no congestion, and it is difficult to implement. Its two families are path pushing, in which each node builds a graph and forwards the waiting paths, and edge chasing, in which special probe messages travel along the edges of the graph, and a process that receives a probe it initiated itself declares deadlock.

Phantom deadlock. A deadlock that the detector reports although it does not exist. It arises because the local graphs are collected at different moments, so the combined graph may contain an edge that has already disappeared, for example because a transaction aborted of its own accord between the two snapshots. The cost is an unnecessary abort, and it is avoided by re-checking the cycle before acting, or by edge chasing, whose probes travel only along edges that still exist.

Avoidance and prevention approaches.

  • Lock all the objects a transaction uses when it starts. It removes hold and wait, and it needs the transaction to know everything it will touch and destroys concurrency.
  • Request locks in a predefined order. It removes circular wait, at the cost of premature locking and reduced concurrency.
  • Timeouts. Each lock is given a limited period in which it is invulnerable, after which a waiting transaction is aborted. It is simple, and a transaction is sometimes aborted when there is no deadlock at all, so the length of the timeout is hard to choose.
  • Wait-die, non preemptive: if Pi requests a resource held by Pj, it may wait only if it has the smaller timestamp, that is if it is older; otherwise it is rolled back. With timestamps 5, 10 and 15, P1 requesting from P2 waits, and P3 requesting from P2 is rolled back.
  • Wound-wait, preemptive: Pi may wait only if it has the larger timestamp, that is if it is younger; otherwise Pj is rolled back. With the same timestamps, P1 requesting from P2 preempts it and P2 is rolled back, while P3 requesting from P2 waits.

Both schemes allow waiting in only one direction along the timestamp order, so a cycle cannot form, and a rolled back transaction keeps its original timestamp so it cannot be starved.

Atomic commit protocols and two phase commit TOP 8/22

Asked 8 times

2081 Bhadra · Q86 marksExplain two-phase commit protocol for handling distributed transactions.

2076 Chaitra · Q9d3 marksWrite short notes on: Two Phase commit protocol

2075 Chaitra · Q86 marksExplain the two-phase commit protocol of handling distributed transactions.

2072 Kartik · Q84 marksExplain the needs and roles of atomic commit protocol in distributed system.

2071 Shrawan · Q9c4 marksWrite short notes on (Any Three): Two Phase Distributed Commit

2070 Chaitra · Q96 marksHow is commitment ensured in distributed transactions?

2070 Ashad · Q82 marksWhat are the roles of atomic commitment protocol (ACP) in distributed transactions?

2069 Chaitra · Q85 marksExplain the two-phase commit protocol of handling distributed transaction.

The need. The atomicity of a transaction requires that when a distributed transaction ends, either all of its operations are carried out or none of them are. The client requested operations at more than one server, so an atomic commit protocol is needed to achieve that effect even if a server crashes during execution. Its role is to collect the servers' decisions, reach one outcome for all of them, and make that outcome survive failures by writing it to stable storage.

Three protocols. One phase commit, in which the coordinator simply tells every server to commit, which fails because a server has no way to abort its part. Two phase commit, which allows any server to abort unilaterally and is what is used. Three phase commit, which avoids blocking when the coordinator fails.

Lecture note figure: the finite state machines of two phase commit, the coordinator moving from init through wait to commit or abort, and the participant moving from init through ready to commit or abort

Phase 1, the voting phase.

  1. When the coordinator is ready to commit, it places a Prepare(T) record in its log on stable storage.
  2. It sends Vote_request(T) to all the participants and waits for replies.
  3. Each participant receives the vote request.
  4. It places Abort(T) or Ready(T) in its local log before replying.
  5. It replies Abort(T) or Ready_to_commit(T).
  6. If it voted abort, it aborts the transaction locally.

Phase 2, the completion phase. If any participant replies abort, the coordinator writes Abort(T) to its log, sends Global_Abort(T) to all participants and aborts locally. If all reply ready to commit, it writes Commit(T) to its log, sends Global_Commit(T) to all and commits locally. Each participant waits for the global message, writes the outcome to its local log, and then aborts or commits accordingly.

How commitment is ensured: nothing is decided until every participant has voted, and every step is written to stable storage before the message that depends on it is sent, so a crashed participant can be told the outcome when it recovers and will reach the same decision as everyone else.

The weakness. If the coordinator crashes while a participant is in the ready state, the participant has voted yes so it may not abort, and it has not been told to commit so it may not commit; it must hold its locks and wait. Two phase commit is therefore a blocking protocol.

Three phase commit HOT 6/22

Asked 6 times

2081 Baishakh · Q78 marksWhat is the difference between two phase and three phase commit protocol? Explain.

2080 Bhadra · Q84 marksExplain three phase commit protocol on handling distributed transactions.

2079 Bhadra · Q84 marksExplain three phase commit protocol with state diagram.

2078 Bhadra · Q96 marksExplain how the problems of 2PC protocols are solved by 3PC.

2076 Chaitra · Q9a3 marksWrite short notes on: Three Phase Commit.

2074 Ashwin · Q84 marksExplain three phase commit protocol with state diagram.

Three phase commit inserts a precommit state between ready and commit, so that a participant which has reached precommit knows every participant voted yes and can therefore commit on its own if the coordinator disappears.

Lecture note figure: the finite state machines of three phase commit, with the extra precommit state between ready and commit on both the coordinator and the participant

The coordinator.

  • Phase 1. It receives the transaction request. If it fails here it aborts the transaction. Otherwise it sends canCommit? to the participants and moves to the waiting state.
  • Phase 2. On a failure, a timeout, or a No in the waiting state, it aborts and sends abort to all. Otherwise it receives Yes from every participant within the time window, sends preCommit to all and moves to the prepared state.
  • Phase 3. If it succeeds in the prepared state it moves to commit. If it times out waiting for an acknowledgement it aborts; when all acknowledgements arrive it commits.

The participants.

  • Phase 1. A participant receives canCommit?; if it agrees it sends Yes and moves to the prepared state, otherwise it sends No and aborts, and on a failure it moves to the abort state.
  • Phase 2. In the prepared state, if it receives abort, fails, or times out waiting for a commit, it aborts. If it receives preCommit it sends an ACK and awaits the final commit or abort.
  • Phase 3. If after receiving preCommit the coordinator fails or times out, the participant goes forward with the commit.

Difference from two phase commit, and how it solves its problems.

PointTwo phase commitThree phase commit
StatesInit, wait or ready, commit or abortThe same, plus a precommit state
Message roundsTwoThree
Coordinator crash while a participant waitsThe participant blocks holding its locks until the coordinator recoversA participant in precommit commits by itself, and one only in ready aborts
BlockingBlocking protocolNon blocking under a coordinator crash
CostLowerAn extra round on every transaction
UseUsed in practiceMostly described in the literature

It is not used widely because of the extra round, because it assumes a synchronous system with reliable timeouts, and because it still fails under a network partition, where two groups may reach opposite decisions.

Optimistic concurrency control HOT 4/22

Asked 4 times

2079 Bhadra · Q74 marksDiscuss the approach of optimistic concurrency control in distributed transactions.

2075 Ashwin · Q96 marksExplain how Optimistic concurrency control mechanism works?

2072 Chaitra · Q84 marksExplain optimistic concurrency control method with its advantages over other concurrency control methods.

2072 Kartik · Q56 marksDiscuss the approach of optimistic concurrency control in distributed transactions.

In optimistic concurrency control transactions are allowed to proceed as though there were no possibility of conflict with other clients, until the client issues closeTransaction. If a conflict did arise, some transaction is aborted and must be restarted by the client. It rests on the observation that conflicts are rare in most applications, so locking makes every transaction pay for a problem that seldom happens.

The three phases.

  • Working phase. Each transaction takes a copy of the most recently committed version of the object. Reads are performed immediately; writes record new values as tentative values, and one object may hold several tentative values at once.
  • Validation phase. When closeTransaction is received, the transaction is validated to confirm whether conflicts occurred. On successful validation it may commit.
  • Update phase. If the transaction is validated, all its tentative values are made permanent.
Lecture slide: the working, validation and update phases of several transactions on a time line, showing the transaction being validated against earlier committed transactions and later active ones

Validation. Each transaction is assigned a transaction number when it enters the validation phase, and Ti precedes Tj when i<j. For the transaction being validated, Tv, to be serialisable with respect to an overlapping transaction Ti, their operations must satisfy:

  • Tv writes and Ti reads: Ti must not read objects written by Tv.
  • Tv reads and Ti writes: Tv must not read objects written by Ti.
  • Tv writes and Ti writes: Ti must not write objects written by Tv and the reverse.

Backward validation compares the read set of Tv with the write sets of transactions that committed since it began, and can only abort Tv. Forward validation compares the write set of Tv with the read sets of the still active transactions, and may instead abort them or defer the validation.

Advantages over the other methods. There is no locking overhead during the working phase and reads run at full speed; deadlock is impossible, because nothing waits for anything; every transaction is allowed to proceed, so concurrency is maximal; and in a distributed setting there is no lock table to maintain across servers. The cost is that under frequent conflict the work of the losing transactions is thrown away, and a long transaction may be starved by repeated aborts.

Timestamp ordering PIN 2/22

Asked 2 times

2081 Bhadra · Q75 marksExplain the timestamp-based ordering technique for concurrency control in DS.

2070 Chaitra · Q11b3 marksWrite short notes on: Timestamp ordering in concurrency control

In timestamp ordering each transaction is assigned a unique timestamp when it starts, and the serial order is fixed in advance to be timestamp order. Each operation is validated as it is carried out, and if it cannot be validated the transaction is aborted immediately.

The two conditions, in words. A request to write an object is valid only if that object was last read and written by earlier transactions. A request to read an object is valid only if that object was last written by an earlier transaction.

The write rule for transaction Tc on object D:

Tcmax(read timestamps on D)andTc>write timestamp on the committed version of D

If it holds, the write is performed on a tentative version of D with write timestamp Tc; otherwise Tc is aborted, because a later transaction has already used the value it would overwrite.

The read rule for transaction Ti: if Ti is greater than the write timestamp on the committed version of D, let Dsel be the version of D with the largest write timestamp not exceeding Ti; if Dsel is committed the read is performed on it, and if it is still tentative the transaction waits until that transaction finishes and then reapplies the rule. Otherwise Ti is aborted.

Why tentative versions are kept: an abort then costs nothing, a reader can be given the correct older version, and cascading aborts are avoided. In a distributed transaction the coordinator issues one globally unique timestamp, usually a local time paired with a server identifier, and passes it to every server, so all the servers enforce the same order.

9Fault tolerance

Backward and forward recovery TOP 8/22

Asked 9 times, in 8 papers

2081 Bhadra · Q95 marksHow do you detect arbitrary faults and recover it? Explain.

2081 Bhadra · Q10c4 marksWrite short notes on: Backward recovery technique in DS

2081 Baishakh · Q68 marksExplain the backward recovery approaches in DS.

2080 Bhadra · Q10b4 marksWrite short notes on: Backward recovery Technique in DS

2076 Chaitra · Q72 marksWhat do you mean by forward and backward recovery?

2075 Chaitra · Q10c4 marksWrite short notes on: Forward and Backward recovery in distributed system

2074 Ashwin · Q96 marksExplain fault recovery techniques.

2072 Kartik · Q9b3 marksWrite short notes on: Recovery approach in Distributed System

2071 Chaitra · Q74 marksDescribe any one failure recovery technique.

Recovery is the set of operations performed after a failure to bring the system back to a correct state, once masking has failed.

Backward recovery brings the system back to a previous correct state, recorded before the error occurred, and continues from there; it needs checkpoints or a log on stable storage. Forward recovery brings the system to a new correct state from which it can continue, without going back; it needs every possible error to be known in advance.

PointBackward recoveryForward recovery
DirectionReturn to a past stateMove on to a new correct state
NeedsCheckpoints or logs on stable storageKnowledge of the possible errors in advance
GeneralityGeneral, works for any errorLimited to the anticipated errors
CostState must be saved regularly and work is repeatedCheap at run time, expensive to design
ExampleRolling a transaction back to its last checkpointAn erasure correcting code that rebuilds a lost packet from those received

The backward recovery approaches.

  • Checkpointing: each process periodically writes its state to stable storage, and after a failure the processes restart from the most recent set of checkpoints that forms a consistent global state, which is the recovery line. It is independent when processes checkpoint without coordinating, and coordinated when they synchronise to take a distributed snapshot.
  • Message logging: infrequent checkpoints are combined with a log of all the messages exchanged between them, so a recovering process restarts from its checkpoint and replays the logged messages instead of recomputing from a distant snapshot.
  • Transaction recovery with UNDO and REDO, driven by the recovery file: faulty transactions and those affected by them are undone, and the non faulty transactions that were undone with them are redone.
  • Shadow paging, in which a shadow page table in non volatile storage holds the state before the transaction, so recovery is simply a matter of using it again.

Its limitation: backward recovery cannot undo effects on the outside world, such as cash already dispensed or a message already sent to another organisation.

Detecting and recovering from arbitrary faults. An arbitrary or Byzantine fault cannot be detected by a timeout, because the process keeps answering; it is detected by comparison, that is by replicating the computation and voting on the results, and by checksums and signatures that reveal an altered message. Once the faulty replica is identified by disagreeing with the majority, it is removed from the group, the correct value is taken from the majority, and the faulty process is restarted from a checkpoint and brought up to date from the survivors.

Checkpointing for distributed recovery HOT 4/22

Asked 4 times

2078 Bhadra · Q84 marksExplain the check pointing approach for distributed recovery.

2076 Chaitra · Q76 marksHow to implement coordinated check pointing for recovery in DS?

2072 Kartik · Q42 marksHow does checkpoint help in recovery?

2071 Shrawan · Q84 marksCompare independent chekpointing with coordinated checkpointing approach.

A checkpoint is a point in time at which the state of a process is written to stable storage. It helps recovery because a crashed process can be restarted from its checkpoint instead of from the beginning, so only the work done since the checkpoint has to be repeated.

The distributed requirement. The set of checkpoints, one per process, must form a consistent global state, that is a consistent cut: no checkpoint may record the receipt of a message whose sending is not recorded. The most recent consistent set is the recovery line.

Lecture slide: two process time lines with independent checkpoints and many messages between them, a failure at the end of one, and the rollback walking backwards through the checkpoints until a consistent cut is found

Independent checkpointing. Each process checkpoints periodically without coordinating. After a failure the system works backwards through the saved checkpoints to find a consistent cut, and all processes restart from it. Its danger is the domino effect: if the latest checkpoints form an inconsistent cut, rolling one process back invalidates another's checkpoint, and in the worst case every process is driven back to the start.

Implementing coordinated checkpointing. All the processes synchronise so that the saved states form a distributed snapshot, consistent by construction. The usual two phase blocking protocol is:

  1. A coordinator multicasts a CHECKPOINT_REQUEST to every process.
  2. On receiving it, each process stops sending application messages, queues any it wants to send, and flushes the channels.
  3. Each process writes its local state to stable storage as a tentative checkpoint and sends an acknowledgement to the coordinator.
  4. When the coordinator has all the acknowledgements it multicasts CHECKPOINT_DONE; each process makes its tentative checkpoint permanent, discards the previous one and resumes sending.
  5. If any process fails to acknowledge, the coordinator multicasts an abort and the tentative checkpoints are discarded.

A non blocking variant uses the Chandy and Lamport marker instead of stopping the processes. On a failure, every process simply rolls back to the latest snapshot, with no search and no domino effect.

PointIndependentCoordinated
CoordinationNone, each process decides aloneAll processes checkpoint together
Run time costLow, no messagesHigher, a synchronisation round and a pause
StorageSeveral checkpoints per process must be keptOnly the latest snapshot
RecoverySearch backwards for a consistent cutRoll back to the last snapshot
Domino effectPossibleImpossible
Best whenProcesses rarely communicateProcesses communicate heavily

Reliable client server communication PIN 2/22

Asked 2 times

2080 Baishakh · Q85 marksHow reliable client server communication can be achieved in DS?

2075 Ashwin · Q104 marksExplain how reliable client server communication can be achieved in distributed system.

Reliable communication between a client and a server means masking the five things that can go wrong during a remote invocation.

Lecture slide: three cases of a server crash during a request, the normal case where the server receives, executes and replies, the case where it crashes after executing but before replying, and the case where it crashes before executing
What goes wrongHow it is handled
The client cannot locate the serverReport back to the client with an exception, since the middleware can do nothing about it
The client's request is lostResend the message after a timeout
The server crashes after receiving the requestApply the chosen RPC semantics: at least once keeps retrying, at most once reports failure, maybe gives no guarantee. Exactly once is impossible in general, because the client cannot tell a crash before execution from a crash after it
The server's reply is lostRetransmit, and make the operations idempotent so repetition is harmless; where they cannot be, the server keeps a sequence number per client and returns the stored reply
The client crashes after sending the requestKill the orphan computation, since the work the server is still doing belongs to nobody and holds resources

Handling orphans is done by extermination, where the client logs every call and kills the orphans on recovery; reincarnation, where recovery starts a new epoch and every computation from an older epoch is killed; gentle reincarnation, which kills only those whose owner cannot be found; and expiration, where a computation is given a fixed quantum and must ask for more.

Triple modular redundancy PIN 1/22

Asked once

2075 Ashwin · Q104 marksHow does triple modular redundancy works?

Triple modular redundancy is fault tolerance by active replication in hardware. Each device is replicated three times, and each stage of the circuit is followed by a triplicated voter.

Lecture note figure: triple modular redundancy, three copies of each stage A, B and C, with a voter after each stage that takes three inputs and outputs the value that at least two of them agree on

How a voter works: it has three inputs and one output. If two or three of the inputs are the same, the output is equal to that input. If all three inputs differ, the output is undefined.

How a fault is masked. Suppose element A2 fails. Each of the voters V1, V2 and V3 receives two good inputs and one rogue input, and each of them outputs the correct value to the second stage, so the inputs to B1, B2 and B3 are exactly what they would have been had no fault occurred. The effect of A2 failing is completely masked. If B3 and C1 also fail in addition to A2, these effects are masked in the same way, and the three final outputs are still correct.

Why it is tripled and not doubled: two components can only detect a disagreement, since there is no way to tell which one is wrong; three allow the majority to correct it. Everyday analogues are an aircraft with four engines that flies on three, and a match with several referees so that one missing an event does not decide it.

Every question from 22 papers · 2069 Chaitra to 2082 Bhadra

The complete question bank

All 265 questions set on this subject, reproduced verbatim from the papers, and the 0 the lecture decks set themselves. Read them by paper, newest first, or by chapter, where repeats are merged and counted. Every question links to its written answer and to the card that teaches it; the 0 calculations link to a worked solution.

How to use the bank

  • By paper: sit a paper from the top, then open each answer. The last three sittings are the best guide to the next one.
  • By chapter: revise a chapter, then answer its questions. A question set in several sittings appears once, with how many times and when, and every other wording under it.
  • Answer links open the exact answer to write; Study links open the card that teaches the topic. A question with two answer links has two parts.
  • DECK marks a question set in the lecture slides, not in an exam. It is answered like the rest but never counted in a tier.

Regular2081 Bhadra

2081 Bhadra · Regular · BCT · 13 questions

Ch 23+5

Q2. Define local and remote method invocation in distributed system. Explain the functional steps taken by modern RPC with its communication semantics.

Ch 22+6

Q3. What is the difference between stateful and stateless distributed file system? Discuss the working principle of any one modern Distributed File System with its architecture.

Ch 52+2+4

Q4. How did the international atomic clock establish? List the basic principle of Lamport's clock and proposed the approach to avoid issues with Lamport's clock.

Ch 62+2+4

Q5. What are the fundamental requirements of Mutual Exclusion in DS? Why is election applicable in DS? Explain the functional steps of anyone election algorithm.

Ch 73+5

Q6. What are the benefits and drawbacks of Replication in DS? How do Gossip Architecture avoid issues of active and passive replication? Explain.

Ch 83+5

Q7. What are the benefits and drawbacks of using locks in distributed transaction processing? Explain the timestamp-based ordering technique for concurrency control in DS.

Ch 82+6

Q8. Compare nested transaction with distributed transaction. Explain two-phase commit protocol for handling distributed transactions.

Ch 93+5

Q9. Define fault, error and failure. How do you detect arbitrary faults and recover it? Explain.

Ch 54

Q10a. Write short notes on: Global state and state recording technique

Ch 14

Q10b. Write short notes on: Goals of DS

Ch 94

Q10c. Write short notes on: Backward recovery technique in DS

Ch 44

Q10d. Write short notes on: CORBA dynamic invocation

Back2081 Baishakh

2081 Baishakh · Back · BCT · 10 questions

Ch 12+8

Q1. What is Distributed System (DS)? Write the importance and goals of DS.

Ch 22+8

Q2. What do you mean by Request Replay Protocol? Discuss how dynamic RMI works.

Ch 210

Q3. Explain the principle operation with architecture of recently used distributed file system.

Ch 52+8

Q4. What is the difference between physical and logical clock? Discuss the principles of Lamport's clock with algorithm.

Ch 7, 610

Q5. How do you elect replica manager in primary backup replication? Explain.

Ch 6, 92+8

Q6. What is byzantine problem? Explain the backward recovery approaches in DS.

Ch 9, 82+8

Q7. What do you mean by Distributed Commit? What is the difference between two phase and three phase commit protocol? Explain.

Ch 85

Q8a. Write short notes on: Distributed Deadlock and its avoidance approaches

Ch 65

Q8b. Write short notes on: Center coordinator algorithm and its issues

Ch 75

Q8c. Write short notes on: Active replication technique in DS

Regular2080 Bhadra

2080 Bhadra · Regular · BCT · 13 questions

Ch 12+6

Q1. Define the term "distributed system". In terms of qualities, advantages and complexities, Compare it with the centralized systems.

Ch 22+6

Q2. Define distributed object and IDL. How RPC operation is performed in client server communication in distributed system.

Ch 24+4

Q3. Explain file service architecture for DFS. Define queries and operation of distributed hierarchical DB: DNS.

Ch 58

Q5. "Vector timestamp mechanism for synchronization is used for causality of events". Justify with the implementation rules and examples.

Ch 62+6

Q6. Define mutual exclusion in distributed system. Explain the steps to elect coordinator in process resilience system.

Ch 72+3+3

Q7. What is the requirement for replications? Compare passive and active replication architectures with necessary figures and steps.

Ch 84+4

Q8. What are the solutions to avoid deadlock in distributed system? Explain three phase commit protocol on handling distributed transactions.

Ch 9, 64+4

Q9. Define faults, failures and errors. How to achieve agreement in faulty system over reliable channel? Explain.

Ch 104

Q10a. Write short notes on: JINI

Ch 94

Q10b. Write short notes on: Backward recovery Technique in DS

Ch 24

Q10c. Write short notes on: Advantages and consequences of statelessness in DFS

Ch 54

Q10d. Write short notes on: NTP

Back2080 Baishakh

2080 Baishakh · Back · BCT · 12 questions

Ch 4, 22+6

Q2. Explain the role of middleware in Distributed System. Explain the operation of dynamic RMI.

Ch 23+5

Q3. Compare stasteful and stateless services. Explain the operation and architecture of any one modern distributed file system.

Ch 52+4+2

Q4. What is physical and logical clock? Explain the importance of VECTOR clock with its implementation rules and example.

Ch 62+2+6

Q5. Compare non token and token based mutual exclusion. Why election is important in DS? Explain the Ring Based election algorithm with rules and example.

Ch 75+5

Q6. What are the different consistency models applicable in a distributed system? How does a primary-backup model work?

Ch 82+6

Q7. Briefly explain different methods for concurrency control. What are the drawbacks of 2PL and how does strict 2PL overcomes those?

Ch 93+5

Q8. Define faults, error and failures. How reliable client server communication can be achieved in DS?

Ch 104

Q9a. Write short notes on: MACH

Ch 54

Q9b. Write short notes on: Strongly Consistent CUT in DS

Ch 34

Q9c. Write short notes on: Multithreading in DS

Ch 44

Q9d. Write short notes on: CORBA services

Regular2079 Bhadra

2079 Bhadra · Regular · BCT · 13 questions

Ch 14+4

Q1. Transparency is one of the important design goals of distributed system. Justify it. List out the advantages of distributed system over centralized system.

Ch 22+3+2

Q2. What is recursive and iterative query? Describe working mechanism of DNS with suitable example. Mention the role of distributed file system.

Ch 24+5

Q3. Define distributed object and remote interface. How RMI helps in distributed programming model? Explain with architecture.

Ch 54+6

Q4. Define cuts of a distributed computation along with its types. How is casual ordering of message realized using vector clocks?

Ch 64+6

Q5. Explain with example how can you achieve consensus in distributed system. Explain ricart-agrawala token based algorithm.

Ch 73+4+2

Q6. List the challenges of replication in DS. Explain how passive replication model supports in fault tolerance. How it is differ than active replication model?

Ch 84+4

Q7. Define flat and nested transactions. Discuss the approach of optimistic concurrency control in distributed transactions.

Ch 5, 9, 86+4

Q8. Explain snapshot algorithm used for backward recovery in distributed system. Explain three phase commit protocol with state diagram.

Ch 33

Q9a. Write short notes on: Process and threads in a DS

Ch 43

Q9b. Write short notes on: ORB and its interfaces

Ch 63

Q9c. Write short notes on: Coordinator election process in central coordinator algorithm

Ch 33

Q9d. Write short notes on: Monolithic and micro kernel

Ch 103

Q9e. Write short notes on: MACH

Regular2078 Bhadra

2078 Bhadra · Regular · BCT · 14 questions

Ch 12+6

Q1. What do you mean by Distributed System (DS)? Explain various models of Distributed Computing Systems.

Ch 24+4

Q2. Elaborate the differences between RMI and RPC. Describe the File Service Architecture of DFS.

Ch 34

Q3a. What are the key differences between Network OS and Distributed OS.

Ch 44

Q3b. Explain the various roles of middleware in DS.

Ch 56+2

Q5. Write implementation rules of Lamport clock. State the limitations of Lamport logical clock.

Ch 64+5

Q6. Compare and contrast token based mutual exclusion algorithm and non-token based mutual exclusion algorithm. Explain the various state of Ricart Agrawala token based mutual exclusion.

Ch 72+4+2

Q7. Mention the requirements and challenges of replication. Explain active replication model in fault tolerance. How it is differ than passive model?

Ch 6, 93+4

Q8. Discuss how Consensus can be achieved in Distributed System. Explain the check pointing approach for distributed recovery.

Ch 82+6

Q9. What are the Flat and Nested Transactions? Explain how the problems of 2PC protocols are solved by 3PC.

Ch 104

Q10a. Write short notes on: JINI

Ch 54

Q10b. Write short notes on: Distributed Debugging

Ch 44

Q10c. Write short notes on: CORBA Architecture

Ch 94

Q10d. Write short notes on: Process Resilience

Regular2076 Chaitra

2076 Chaitra · Regular · BCT · 13 questions

Ch 12+8

Q1. Define Distributed System (DS). Explain the requirements to successfully implement DS to suit to modern computing.

Ch 23+5

Q2. Discuss the functionalities provided by RMI software. How is the event and notification system implemented in distributed object based communication?

Ch 22+7

Q3. What is distributed file system? Explain the principle operations of any one modern distributed file system?

Ch 52+8

Q4. What is the issue in Lamport's timestamp? How do you avoid the issue? Explain with your alternate algorithm.

Ch 65+5

Q5. How does a new coordinator elect in executing central coordinator algorithm? How to come to consensus in DS? Explain.

Ch 92+6

Q7. What do you mean by forward and backward recovery? How to implement coordinated check pointing for recovery in DS?

Ch 84+4

Q8. What are the alternative approaches to avoid possibility of deadlock in distributed system? Explain.

Ch 83

Q9a. Write short notes on: Three Phase Commit.

Ch 43

Q9b. Write short notes on: CORBA component for RMI

Ch 53

Q9c. Write short notes on: Physical Clock Synchronization: Cristain's Algorithm

Ch 83

Q9d. Write short notes on: Two Phase commit protocol

Ch 103

Q9e. Write short notes on: MACH

Back2076 Ashwin

2076 Ashwin · Back · BCT · 12 questions

Ch 18

Q1. What are the major goals of distributed system and what are the challenges during the design of distributed system.

Ch 28

Q3. Define Distributed file system. Point out the differences between stateless and stateful services.

Ch 48

Q4. Explain components in CORBA architecture with a diagram.

Ch 58

Q5. Explain Lamport's logical clock with its pros and cons.

Ch 68

Q6. Explain reliable multicast with its properties and an algorithm.

Ch 78

Q7. Specify Data Centric consistency models and explain any one of them in detail.

Ch 88

Q8. Why is it necessary to maintain transaction? What is a deadlock and what are phantom deadlocks.

Ch 98

Q9. What is fault tolerance? Explain different type of faults that may occur in a distributed system.

Ch 24

Q10a. Write short notes on any two: RPC

Ch 34

Q10b. Write short notes on any two: Monolithic and micro kernel

Ch 104

Q10c. Write short notes on any two: Mach

Regular / Back2075 Chaitra

2075 Chaitra · Regular / Back · BCT · 12 questions

Ch 14+4

Q1. Why distributed system is preferred over centralized system? Explain the layers of transparency.

Ch 22+6

Q3. Compare Stateful and stateless service. Describe the architecture and operation of SUNNFS with its services.

Ch 54+4

Q5. List the problems of Lamports clock with example. How vector clock is beneficial than Lamports clock? Explain with implementation rules of vector clock.

Ch 62+6

Q6. How token system works for mutual exclusion in Distributed System. Explain with token based Algorithm.

Ch 72+6

Q7. How replication is used as a basic scaling technique in distributed system? Explain the active replication model with its advantages and disadvantages.

Ch 82+6

Q8. Compare nested transactions and distributed transactions. Explain the two-phase commit protocol of handling distributed transactions.

Ch 6, 93+5

Q9. What do you learn from Byzantine generals problem? Explain the basic principle of K-fault tolerant.

Ch 94

Q10a. Write short notes on: Reliable Group Communication

Ch 84

Q10b. Write short notes on: Distributed deadlock

Ch 94

Q10c. Write short notes on: Forward and Backward recovery in distributed system

Back2075 Ashwin

2075 Ashwin · Back · BCT · 13 questions

Ch 12+6

Q1. Define distributed system? Explain Transparency Properties of Distributed System.

Ch 22+6

Q2. Why naming is necessary in distributed system? Explain Sun Network File System architecture with its features.

Ch 22+6

Q3. What is DNS? Explain the DNS working mechanisms with suitable example.

Ch 32+4

Q4. What do you mean by DOS (Distributed Operating System)? Briefly explain the Monolithic and microkernel architectures of operation system.

Ch 52+4

Q6. What is Network Time Protocol (NTP)? How Berkeley minimizes the problems of single time server failures of Chistian's algorithm.

Ch 62+6

Q7. What is the need of an election algorithm? Explain non token based Ricart-Agrawala mutual exclusion algorithm along with an example.

Ch 73+5

Q8. Differentiate between passive and active replication approach. Discuss with a technique that make the distributed system highly available.

Ch 82+6

Q9. Write down the rule of two-version locking. Explain how Optimistic concurrency control mechanism works?

Ch 94+4

Q10. How does triple modular redundancy works? Explain how reliable client server communication can be achieved in distributed system.

Ch 53

Q11a. Write short notes on: Lamport's clock

Ch 103

Q11b. Write short notes on: TIB/Rendezvous

Ch 63

Q11c. Write short notes on: Feedback suppression mechanism in M-cast communication

Back2074 Ashwin

2074 Ashwin · Back · BCT · 12 questions

Ch 12+6

Q1. Why there are challenges in achieving some requirements of a distributed system? Explain the challenges associated with different requirements of distributed system.

Ch 23+5

Q3. What is stateful and stateless service in file system? Explain the DNS working mechanism with suitable practical example.

Ch 3, 44+4

Q4. What are the characteristics of distributed operating system? Explain ORB and its interfaces.

Ch 52+6

Q5. Why clock synchronization is necessary? Explain the clock synchronization algorithm using vector clock along with an example.

Ch 68

Q6. Describe non-token based centralized and Ricart Agrawala algorithm with example and compare them.

Ch 73+5

Q7. Differentiate between active and passive replication. Explain working mechanism of active replication.

Ch 88

Q8. How cascading aborts occurs and solved? Explain three phase commit protocol with state diagram.

Ch 92+6

Q9. What is K-fault tolerant system? Explain fault recovery techniques.

Ch 84

Q10a. Write short notes on: Distributed deadlock and recovery

Ch 104

Q10b. Write short notes on: MACH

Ch 94

Q10c. Write short notes on: Process Resilience

New Back (2066 and Later Batch)2073 Shrawan

2073 Shrawan · New Back (2066 and Later Batch) · BCT · 12 questions

Ch 13+5

Q1. What are the principle applications of Distributed System (DS)? Discuss the advantages and disadvantages of DS.

Ch 24+4

Q2. What are the requirements of Distributed File System? Describe file service architecture for Distributed File System.

Ch 21+4

Q3a. Why naming is necessary in distributed system? Explain Domain Naming Service (DNS) with its features.

Ch 32+3

Q3b. What are the advantages of micro-kernel over monolithic-kernel? In your view, which kernel is preferable for distributed Operating system and why?

Ch 44

Q4a. What are the components of CORBA environment?

Ch 52+6

Q4b. What do you mean by logical clock? Explain Lamport's Logical clock.

Ch 54+6

Q5. What are the principle applications of state recording and distributed debugging? Determine the types of distributed CUT in the following figure.

Ch 62+6

Q6. Define distributed coordination in DS? Explain how token ring algorithm works for mutual exclusion in DS.

Ch 76+2

Q7. Define replication and fault tolerance in DS and explain why are they necessary? Explain how replication enhanced scalability for DS.

Ch 84+6

Q8. What is LOCK and DEADLOCK in DS? Discuss the methods of distributed deadlock avoidance.

Ch 93

Q9a. Write short notes on: Process Resilience

Ch 103

Q9b. Write short notes on: Mach

Regular2072 Chaitra

2072 Chaitra · Regular · BCT · 10 questions

Ch 12+6

Q1. Differentiate between centralized and distributed system? Explain the design issues related to distributed system.

Ch 22+6

Q2. Discuss the importance of Distributed File System (DFS). Describe the operations of SUNNFS with its properties.

Ch 52+2+6

Q5. Differentiate between physical clock and logical clock. Why it is difficult to synchronize physical clock? Describe a method for physical clock synchronization.

Ch 62+8

Q6. What are the basic requirements for mutual exclusion in distributed system? Explain the non-token based distributed mutual exclusion algorithm and compare it with token based algorithm.

Ch 73+5

Q7. What are the reasons for Replication? Explain active replication model with its advantages and disadvantages.

Ch 82+4+2

Q8. What do you mean by nested transactions? Explain optimistic concurrency control method with its advantages over other concurrency control methods.

Ch 104

Q9b. Write short notes on: JINI

New Back (2066 and Later Batch)2072 Kartik

2072 Kartik · New Back (2066 and Later Batch) · BCT · 12 questions

Ch 12+6

Q1. What is Distributed System? Discuss the challenges of Distribution System with example.

Ch 3, 94+2+2

Q4. How threads differ from process? How does checkpoint help in recovery? What does distributed commit refer to?

Ch 84+6

Q5. Define flat and nested transaction. Discuss the approach of optimistic concurrency control in distributed transactions.

Ch 52+6

Q6. Why it is difficult to synchronize physical clock? Explain how clock synchronization can be solved using logical clock.

Ch 74+4

Q7. What are the reasons for replicating the service provide? Discuss about fault tolerant services.

Ch 88

Q8. How cascading aborts occurs and can be solved? Explain the needs and roles of atomic commit protocol in distributed system.

Ch 53

Q9a. Write short notes on: Christian's Algorithm

Ch 93

Q9b. Write short notes on: Recovery approach in Distributed System

Ch 43

Q9c. Write short notes on: CORBA services

Ch 33

Q9d. Write short notes on: Monolithic and Microkernel

Regular2071 Chaitra

2071 Chaitra · Regular · BCT · 12 questions

Ch 16+2

Q1. "Distributed system acts as a single coherent system to its end user." Justify the statement with its features and challenges. What is fundamental model?

Ch 210

Q3. Verify with proper explanations that DNS is a distributed hierarchical database system.

Ch 68

Q4. Write the importance of election algorithm. Explain BULLY algorithm with suitable example. Compare it with Ring based algorithm.

Ch 10, 4, 34+2+2

Q5. List the goals of JINI. What are CORBA services? How does operating system support for distributed system?

Ch 610

Q6. Explain with algorithmic steps, how token ring algorithm works for mutual exclusion in distributed system.

Ch 6, 98

Q7. Explain Byzantine general problem to handle faulty process with example. Describe any one failure recovery technique.

Ch 81+4+3

Q8. Define lock in concurrency control. How can concurrency be controlled in distributed transactions? What situation does lead to distributed deadlock?

Ch 44

Q9a. Write short notes on: Heterogeneity in distributed system

Ch 104

Q9b. Write short notes on: Rendezvous concept and implementation

Ch 94

Q9d. Write short notes on: Process Resilience

New Back (2066 and Later Batch)2071 Shrawan

2071 Shrawan · New Back (2066 and Later Batch) · BCT · 13 questions

Ch 16+2

Q1. Discuss the properties of Distributed System (DS). How interaction model addresses the relevant issues in DS?

Ch 23+5

Q3. What are the characteristics of SUN-NFS? Discuss with its architecture.

Ch 53+5

Q4. What are the common problems of physical clock synchronization algorithms? Write Chandy-Lamport's algorithm for recording global states in Distributed System.

Ch 62+6

Q5. Measure the performance issue of non-token based Ricart-Agrawal Algorithm. Write alternate algorithm to address those performance issues.

Ch 6, 73+5

Q6. How to come to consensus in DS? Discuss with an approach, how do you make the distributed system service highly available?

Ch 84+8

Q7. What are the relationships between parent and child transactions in DS? Write the problems of locking with the solutions to avoid it.

Ch 94+4

Q8. How do you avoid faults in DS? Compare independent chekpointing with coordinated checkpointing approach.

Ch 34

Q9a. Write short notes on (Any Three): Monolithic and Micro-Kernel

Ch 44

Q9b. Write short notes on (Any Three): Services provided by CORBA with the functions of Object Adapter

Ch 84

Q9c. Write short notes on (Any Three): Two Phase Distributed Commit

Ch 54

Q9d. Write short notes on (Any Three): Distributed Debugging

Ch 24

Q9e. Write short notes on (Any Three): RPC communication semantics

Regular2070 Chaitra

2070 Chaitra · Regular · BCT · 12 questions

Ch 12+6

Q1. Define Distributed System, What are advantages and disadvantages of distributed system?

Ch 26+2

Q2. Draw and explain distributed file service architecture. How does that architecture encourage the sharing of storage resources in distributed system? Explain.

Ch 22+6

Q3. Differentiate between RPC and RMI. How does modern RPC maintain the transparency in distributed system?

Ch 32+2

Q4. Compare process and threads. Why threads are important in distributed System.

Ch 4, 32+4

Q5. Give an example of heterogeneous model of distributed application. How is distributed operating system realized in practical distributed systems? Explain.

Ch 52+4+2

Q6. What do you mean physical and logical clocks? Explain Network Time Protocol and Berkeley Algorithm for physical clock synchronization.

Ch 62+6

Q7. How does mutual exclusion help in co-ordination in distributed system? Explain the way how Lamport algorithm ensures mutual exclusion?

Ch 73+5

Q8. What are the major objectives for replication in distributed system? Explain primary backup model for fault tolerance.

Ch 82+6

Q9. Differentiate between nested transaction and distributed transaction with examples. How is commitment ensured in distributed transactions?

Ch 9, 61+2+5

Q10. What do you mean by fault tolerant system? What do you mean by Byzantine Failure? Explain Byzantine Generals problem to illustrate how agreement can be reached in faulty system.

Ch 103

Q11a. Write short notes on: Comparison of CORBA and Mach

Ch 83

Q11b. Write short notes on: Timestamp ordering in concurrency control

New Back (2066 and Later Batch)2070 Ashad

2070 Ashad · New Back (2066 and Later Batch) · BCT · 12 questions

Ch 12+6

Q1. How do you define Distributed System? Explain with the model, how hardware, data and controls are distributed in the distributed system environment.

Ch 24+4

Q2. Explain the ways how distributed objects communicate with each other. Differentiate between RPC and RMI.

Ch 22+6

Q3. Define distributed file system. Draw and explain distributed file service architecture in detail.

Ch 44

Q4. Differentiate between homogeneous and heterogeneous distributed applications with example.

Ch 52+6

Q5. Compare physical clocks and logical clocks with its implementation semantics. Describe Lamport's timestamp algorithm with its benefits and drawbacks.

Ch 65+3

Q6. Explain any one election technique in Distributed System. Discuss with steps how consensus can be achieved in Distributed System.

Ch 72+4

Q7. How do you say that replication is one of the scaling techniques in Distributed System? How to handle concurrent invocations with object replication in distributed object based system?

Ch 82+6

Q8. What are the roles of atomic commitment protocol (ACP) in distributed transactions? Explain the different methods of concurrency control in distributed transactions.

Ch 9, 62+2+4

Q9. What are the dependability requirements of fault tolerant system? What do you mean by K-fault tolerant? How to come agreement in faulty system? Explain with the approach of byzantine generals problem.

Ch 42+4

Q10. Write different services provided by CORBA. What are dynamic and static invocation approaches of CORBA.

Ch 34

Q11a. Write short notes on: Process and threads in OS

Ch 94

Q11b. Write short notes on: Distributed commit

Regular2069 Chaitra

2069 Chaitra · Regular · BCT · 11 questions

Ch 14+4

Q1. What are the major goals of distributed system? Explain the need of transparency in distributed system along with the challenges in achieving that.

Ch 4, 23+5

Q2. How do you convince that middleware plays the important role in Distributed System? Explain the operation of RPC in client server communication in Distributed System.

Ch 23+5

Q3. What do you mean by file and directory service? Explain the operation of SUN NFS with its architecture.

Ch 34+4

Q4. Why network operating system (NOS) is widely preferred over distributed operating system (DOS) in practical distributed systems? Explain DOS as a middleware.

Ch 52+6

Q5. Define logical and physical clocks. Explain Lamport timestamp algorithm along with an example.

Ch 62+4

Q6. Present a practical scenario where you need an election algorithm. Explain an election algorithm with example that is suitable to your scenario.

Ch 72+4

Q7. Compare passive replication with active replication approach. Also discuss with a technique that make the distributed system service highly available.

Ch 82+5

Q8. What do you mean by Distributed Deadlock? Explain the two-phase commit protocol of handling distributed transaction.

Ch 83+4

Q9. What are the flat and nested transactions? Describe the methods for concurrency control in distributed system.

Ch 92+2+4

Q10. What do you mean by faults, failures and errors? How do you handle faults in Distributed System? Explain process resilience approach in brief.

Regular / Back2068 Chaitra

2068 Chaitra · Regular / Back · BCT · 8 questions

Ch 14+4

Q1. Describe precisely what is meant by a scalable system. Explain distribution transparency in Distributed Systems.

Ch 28

Q2. Explain how GFS handles client request?

Ch 28

Q3. Why do we have single master in GFS managing millions of chunk servers? What are done to manage it without overloading single master?

Ch 28

Q4. Explain the control flow of write mutation with diagram.

Ch 28

Q5. Suppose your company got more investment so you can now increase your default replication order by 2 from current value 3 so as to make it your data more available and reliable. Suddenly master has to create two replicas of each file chunks. Yet, it has to satisfy client request which are more important than just replication. How does single master manage re-replication task?

Ch 24

Q6. List and explain four main master operations in GFS.

Ch 24+4

Q7. Explain term 'NoSQL'. Why does normalization fail in data analytics scenario?

Ch 28

Q8. Define the components that make up a basic MapReduce job and illustrate with diagram how does the data flow through Hadoop MapReduce.

Regular / Back2068 Baishakh

2068 Baishakh · Regular / Back · BCT · 15 questions

Ch 15

Q1a. Discuss pitfalls of distributed system.

Ch 15

Q1b. What are goals of distributed system? Explain scalability goal in detail.

Ch 15

Q2a. Explain Distributed computing systems.

Ch 15

Q2b. Define architectural styles. Describe common architectural styles.

Ch 15

Q3a. Explain different centralized system architectures.

Ch 15

Q3b. Discuss super peer in decentralized architecture.

Ch 25

Q4a. Discuss the single master aspect of GFS architecture.

Ch 25

Q4b. Enlist GFS metadata. Why chunk locations not persisted by master, discuss it.

Ch 25

Q5a. Discuss consistency guarantees made by GFS.

Ch 25

Q5b. Explain the lease mechanism in GFS with examples.

Ch 25

Q6a. Discuss GFS high availability.

Ch 25

Q6b. Discuss re-replication and rebalancing role of GFS master.

Ch 210

Q7. Define referential transparency with example. Explain mapreduce program execution flow.

Ch 25

Q8a. Write pseudo code for inverted index (term vector per host) generation through mapreduce.

Ch 25

Q8b. Discuss fault tolerance of mapreduce jobs.

Regular / Back2067 Mangsir

2067 Mangsir · Regular / Back · BCT · 11 questions

Ch 13+7

Q1. Discuss the important characteristics of Distributed Systems. Explain distribution transpareny goal of distributed systems

Ch 12+4+4

Q2. What is an architectural style? Discuss with one example structured P2P architecture. What is a super peer, discuss its usage in P2P systems?

Ch 26+4

Q3. Discuss assumptions made in GFS design and their consequences. Explain the metadata of GFS?

Ch 210

Q4. Explain data and control flow and working of lease mechanish in normal write operation of GFS.

Ch 23+8

Q5. Discuss the main points that MR draws from referential transpareny in functional programming. With an example of your choice explain the MapReduce programming model.

Ch 210

Q6. You are given student records consisting of following fields in each record: rollno(integer), department id (integer), name (string), subject code(integer), score on the subject (double). You can assume the delimiter of the fields as space. It is required to calculate the agerage value of score for a student and present the average score and total score along with name, department and rollno of the student in the output records. The order of the output be according to rollno, and if the same rollno appear in two departments then by rollno+department. (Note here that the rollno and department id are integers not strings). Write a complete code for mapper, reducer, combiner(if any), partitioner(if any) in Java language on Hadoop platform. You can ommit the job submission and imports part. Clearly specify the key/value data types in each phase. OR Write a complete pseudocode for mapper, reducer, partitioner(if any), combiner(if any) along with clear explanation of the key/value types in each phase.

Ch 26+4

Q7. Discuss the problems associated with parameter passing in RPC. Explain with diagram different alternatives of asynchronous RPC.

Ch 63

Q8a. Explain any 3 of the following: Use of multicast communication in Distributed systems

Ch 23

Q8b. Explain any 3 of the following: External sort is related with MR programming model in Hadoop

Ch 23

Q8c. Explain any 3 of the following: Compression can improve the performance of MapReduce job

Ch 13

Q8d. Explain any 3 of the following: P2P style of architecture of Cassandra (just discuss to show the p2p style not the entire architecture)

23 formulas · click any formula for where it comes from

The formula sheet

A theory paper still carries a handful of formulas: the HDI, the three power equations for sun, water and wind, the solar sizing steps, and the storage relations. Here they are in one scroll. Click a formula to see where it comes from, and read the line under it for the question it earns marks in.

How to use this page

  • Three equations carry the calculations: P=ηρgQH for hydro, P=12ρAV3 for wind, and the solar sizing chain. Know them cold.
  • Open each explanation once, then close it and rebuild the formula from the idea.
  • Test yourself in the flashcards, which ask these same formulas.

1Introduction

How much availability do n independent replicas give?
A=1pn
The "increased availability" reason for replication, and any question asking why replication raises availability.
Where it comes from Each of the n servers is down with independent probability p, so all n are down with probability p to the power n, and the service is available the rest of the time. The word independent is load bearing: two servers on one power supply do not multiply like this.
How many hops does a lookup take in a structured P2P overlay?
O(logN)
Structured P2P architecture, 2067 Mangsir Q2.
Where it comes from A Chord node keeps a finger table of m entries, where entry i points to the successor of (n + 2^{i-1}) mod 2^m. Each hop at least halves the remaining distance round the ring, so a lookup among N nodes finishes in about log N steps.

5Time and state

What bound does a clock with drift rate rho obey?
1ρdCdt1+ρ
Why physical clock synchronisation is difficult, and why it must be repeated.
Where it comes from A perfect clock advances one second per second, so dC/dt is 1. A real crystal is fast or slow by at most rho, so two clocks can differ by 2 rho t after time t, and a system that must hold them within delta has to resynchronise every delta / (2 rho) seconds.
What does Cristian's algorithm set the client clock to?
Tnew=T+RTT2,RTT=T1T0
Cristian's algorithm, asked in three sittings as a short note or as a method for physical clock synchronisation.
Where it comes from T is the time the server wrote into the reply. The client measured T0 and T1 on its own clock, so RTT is known without any agreement about time. Assuming the round trip is split equally between the two directions, the reply is RTT/2 old when it arrives.
How accurate is Cristian's algorithm?
±(RTT2min)
The accuracy part of any Cristian's algorithm question.
Where it comes from If min is the least possible one way transmission time, the server's clock when the client reads the reply lies between T + min and T + RTT - min. That range is RTT - 2 min wide, so the estimate is out by at most half of it.
How does NTP compute the total transit time?
d=(T4T1)(T3T2)
NTP, asked in three sittings.
Where it comes from A sends at T1 and receives at T4, both on its own clock, so T4 - T1 is the whole exchange. B reports T2 and T3, so T3 - T2 is the time spent inside B. The difference is the time spent on the network.
How does NTP compute the offset between two clocks?
o=(T2T1)+(T3T4)2
NTP, and any question that asks how the clocks are actually corrected.
Where it comes from Assuming the two directions take the same time, B's clock at the moment A reads T4 was about T3 + d/2. Subtracting T4 and substituting d gives this form. NTP keeps the last eight pairs of offset and delay and uses the offset whose delay was smallest.
What are Lamport's three implementation rules?
(1) before each event: Ci:=Ci+1(2) on sending m:send (m,t) with t=Ci(3) on receiving (m,t):Cj:=max(Cj,t)+1
Lamport's logical clock, the single most asked item in the subject, eleven sittings.
Where it comes from The counter is a plain integer per process and it is never compared with real time. Rule 1 makes every event of a process get a distinct, increasing number. Rule 2 carries that number with the message so the receiver can see how far the sender had got. Rule 3 is the one that matters: without the maximum, a message could be stamped as received before it was sent, which the lecture diagram marks impossible, and causality would be violated by the clock meant to preserve it.
What does Lamport's clock guarantee, and what does it not?
abC(a)<C(b),but not the converse
The limitation of Lamport's clock, asked in five sittings.
Where it comes from Two concurrent events may pick up any two numbers independently, so a smaller timestamp proves nothing. This is why the clock is said not to be a true clock and why vector clocks exist.
What are the vector clock rules?
internal event at Pi:Vi[i]:=Vi[i]+1send: Vi[i]:=Vi[i]+1, send the whole Vireceive t:Vj[j]:=Vj[j]+1,Vj[k]:=max(Vj[k],t[k]) k
Vector clocks, asked in five sittings, usually "with implementation rules and example".
Where it comes from V_i[i] counts this process's own events and V_i[j] is what it knows of process j, so taking the element wise maximum on receipt merges the sender's knowledge into the receiver's.
How are two vector timestamps compared?
u=vu[i]=v[i] iuvu[i]v[i] iu<vuv and uvuv¬(u<v) and ¬(v<u)
The "how is vector clock beneficial than Lamport clock" part, four sittings.
Where it comes from Two vectors are ordered only when one dominates the other in every element, which is why concurrency is the common case rather than the exception. This gives the property Lamport's clock lacked: a happened before b if and only if V(a) < V(b), so causality can be read straight off the two timestamps with no further information, which is the whole reason for paying N integers a message.
When may a causally ordered message be delivered?
tm[i]=Vj[i]+1andtm[k]Vj[k]  ki
Causal ordering of messages using vector clocks, 2079 Bhadra Q4.
Where it comes from The first condition says this is the next message expected from the sender, so none has been missed. The second says the receiver has already seen everything the sender had seen when it sent. Otherwise the message waits in a queue.

6Coordination and agreement

How many messages does each mutual exclusion algorithm cost per entry?
central coordinator:3Lamport:3(N1)Ricart-Agrawala:2(N1)token ring:1 to 
Every "compare token based and non token based" question, five sittings.
Where it comes from Lamport sends a request, a reply and a release to each of the other N-1 sites. Ricart-Agrawala drops the release by deferring the reply instead, saving a third. The token ring needs one message if the token happens to be next door and unbounded many if it is idling round the ring.
What do the two election algorithms cost?
Bully, best case:N2Bully, worst case:O(N2)Ring, average:2N+N2Ring, worst case:3N1
Bully against ring comparison, 2071 Chaitra Q4 and 2080 Baishakh Q5.
Where it comes from Bully is worst when the lowest process starts, because every higher process then starts its own election. The ring needs one circuit to find the largest identifier and another to announce it.
How many processes are needed for Byzantine agreement?
N3f+1for f faulty processes, in f+1 rounds
The Byzantine generals problem, six sittings.
Where it comes from Equivalently, a solution exists only if fewer than one third of the processes are faulty. With three generals and one traitor a correct lieutenant sees two conflicting values and no majority; with four it sees three and can vote.
How many rounds does synchronous consensus need?
f+1 rounds for f crash failures
"How can consensus be achieved in DS", five sittings.
Where it comes from At most f processes can fail, so at least one of the f+1 rounds is free of failures, and in that round every process receives every value the others hold. Their sets are then identical and the same function gives the same decision.

7Replication

How much replication does k fault tolerance need?
fail-stop faults:k+1 processesByzantine faults, voting:2k+1 processesByzantine agreement:3k+1 processes
K fault tolerant systems, five sittings across chapters 7 and 9.
Where it comes from A fail-stop process gives no answer, so one survivor is enough. A Byzantine process gives a wrong answer, so the correct ones must outvote it. Agreeing on a value whose source may also lie needs two thirds correct.
What must a read and write quorum satisfy?
W>N2andR+W>N
Transactions with replicated data, and any question about network partitions.
Where it comes from The first rule means only one partition can hold a write quorum, so two halves of a partitioned network cannot both write. The second means every read quorum overlaps every write quorum in at least one replica, so a read always sees the latest write.

8Transactions and concurrency control

What is the write rule of timestamp ordering?
Tcmax(read timestamps on D)Tc>write timestamp of the committed D
Timestamp ordering, 2081 Bhadra Q7 and the short note in 2070 Chaitra.
Where it comes from If it holds, the write goes to a tentative version of D stamped T_c. If it does not, a later transaction has already used the value this write would replace, so T_c is aborted at once rather than made to wait.
What is the read rule of timestamp ordering?
Ti>write timestamp of the committed Dread Dsel,Dsel=max{Dv:ts(Dv)Ti}
Timestamp ordering, the second half of the rule.
Where it comes from Read the newest committed version not later than your own timestamp. If that version is still tentative, wait for the transaction that wrote it. If the condition fails, a later transaction has already overwritten what you should have read, so abort.
What three conditions does optimistic validation check?
Tv writes,Ti reads:Ti must not read objects written by TvTv reads,Ti writes:Tv must not read objects written by TiTv writes,Ti writes:neither writes objects written by the other
Optimistic concurrency control, four sittings.
Where it comes from T_v is the transaction being validated and T_i is any overlapping transaction. Backward validation compares T_v's read set with the write sets of transactions already committed; forward validation compares T_v's write set with the read sets of transactions still active.
What is the rule of two phase locking?
no new lock after the first release: growing phase, then shrinking phase
Locking and the drawbacks of 2PL, six sittings.
Where it comes from That single rule is what guarantees serial equivalence. Strict two phase locking goes further and holds every lock until commit or abort, which is what prevents dirty reads and therefore cascading aborts.

9Fault tolerance

Which fault tolerance measures give which invocation semantics?
maybe:no retransmissionat least once:retransmit, no duplicate filtering, re-executeat most once:retransmit, duplicate filtering, retransmit the stored reply
RPC communication semantics, asked in chapter 2 and again as reliable client server communication in chapter 9.
Where it comes from A local call is exactly once. A remote call cannot be, because the client cannot tell a server that crashed before executing from one that crashed after. At most once is the strongest an RMI system offers.

217 cards · 23 formulas, 62 definitions and 132 exam questions · what you miss comes back sooner

Flashcards

The definitions, the formulas and every exam question, asked one at a time. Mark yourself honestly: a card you knew moves up a box and waits twice as long, a card you did not drops to box one and comes back before you leave the page. Your boxes are saved in this browser, and nothing leaves the device.

How this works

  • Five boxes. A new card starts in box one. Knowing it moves it up; missing it sends it back to box one.
  • The box sets the wait: one day, two, four, eight, then sixteen.
  • A theory card shows the opening of the answer, the line to start with; its link opens the full answer.
  • Saved in this browser only. Clearing site data resets it.

10 maps · 87 topics · 161 lists · 759 items

Every chapter as one map

This is a theory paper, and theory marks are lost on “name the types”: you can explain a term and still go blank on the list. Each map opens whole: the chapter, its topics, every list and every member, with the size of each list beside its name. Press Close all and the items go while the names and counts stay, so “4 Biomass conversion routes” becomes a question. The canvas pans, zooms and goes full screen. Every map is built from the chapter cards themselves, so it always matches them.

How to use the maps

  • Press anything to have it explained. A topic, a list or a single item opens a note beside the map; the arrow beside a topic opens its card.
  • Close all turns the map into a test. Name the members of each list before you open it. Answering before you look is what moves a list into memory.
  • The count is half the memory. Knowing there are six criteria tells you to keep going when you have named four.
  • Drag to move, zoom with the buttons or ctrl and the wheel; Fit puts the whole chapter back on screen.
100%

Drag to move · ctrl and wheel to zoom

Chapter 1Introduction 11 topics · 20 lists · 87 items