UP | HOME
2020-01-02 | ../../

DistrComp Course Overview

Table of Contents

1 Course Home Page

  1. DIC Course Home Page [Do click this link.]
  2. Visit this Home Page regularly. Once a day?

2 Syllabus

The next few slides will do:

  1. Course Description
  2. Source Materials
  3. Course Content

2.1 What is Distributed Computing?

  1. Distributed Computing is coordinated computing using machines at many locations.
  2. It primarily uses message passing.
  3. It tries to avoid synchronization.
  4. It tries to avoid shared variables.
  5. It tries to be robust in the presence of individual machine failures.

2.2 Detailed content #1

  1. Semantics of semicolon, parallel-bar, and fat-bar.
  2. Review of classic problems in concurrency.
  3. Semaphores: weak and strong, split-binary, distributed.
  4. Distributed Termination.
  5. CSP (Communicating Sequential Processes).
  6. GO Language Systems Programming.

2.3 Detailed content #2

  1. Distributed Tuple Space and Linda.
  2. Clients and Servers, RPC, RMI.
  3. Actors, Scala Akka.
  4. Distributed file servers. IPFS.
  5. Semantics of Concurrency. Axiomatic Semantics. Temporal Logic.
  6. Fairness. Starvation. Mutual exclusion. Deadlocks. Livelocks. Interference.

2.4 Prerequisites

  1. Undergraduate course on OS Internals and Concurrent Programming
  2. Fluency in C++ and Java; Fluency in Go is not expected.
  3. Familiarity with Linux OS and IPC mechanisms.

2.5 Course Objectives

  1. Understand the technologies of Remote Invocation (RPC, RMI), and Actors in several languages.
  2. Understand the principles of concurrent, distributed, networked, and parallel computing.
  3. Understand non-deterministic computations and unfair scheduling as givens.

2.6 Learning Outcomes

  1. Write client-server programs using RPC in C/C++, RMI in Java, and Channels in Go, and Actors in Scala.
  2. Use distributed file server technology, e.g., IPFS.
  3. Reason about programs using assertions and temporal logic.
  4. Become fluent in Go and Scala.

2.7 Source Materials: Books

  1. Gregory R. Andrews, Concurrent Programming: Principles and Practice, Benjamin/Cummings, 1991. {A classic. Look for it on EBay? Text Book.} See also his revision of the above book. ./andrews-multithreaded-toc.html [We will do Chapters 1 and 2 much later in our course.]
  2. Alan A. A. Donovan and Brian W. Kernighan. The Go Programming Language. 201x.
  3. Andrew S. Tanenbaum and Maaten Van Steen. Distributed Systems: Principles and Paradigms. 201x

2.8 Source Materials: On Line

  1. Course Home Page All course related announcements will be posted on this page.
  2. Scala + Akka Documentation, https://doc.akka.io/docs/akka/current/?language=scala
  3. Java tutorial, https://docs.oracle.com/javase/tutorial/
  4. https://github.com/theanalyst/awesome-distributed-systems "A curated list to learn about distributed systems."

2.9 Fundamentals (4 lectures)

  1. Starvation, deadlocks, livelocks. Interference, fairness, safety and liveness properties. Fine-grain and coarse-grain parallelism.
  2. Review of classic problems in concurrency.
  3. Proper definition of semaphore. Weak and strong semaphores. Split-binary semaphores.
  4. Starvation-free mutual exclusion.
  5. Readers-Writers and the technique of "passing the baton.''

2.9.1 Refs

  1. Andrews, Chapters 1, 2, 3.1, 3.5, 4, 5, 6, and Section 10.2.
  2. Jan Tijmen Udding, "Absence of Individual Starvation Using Weak Semaphores,'' Information Processing Letters, Vol. 23, 1986, 159-162.
  3. Allen B. Downey , "The Little Book of Semaphores", freely downloadable book, 201x, http://www.greenteapress.com/semaphores/

2.10 Remote Invocation (4)

  1. Remote Procedure Calls (RPC), and Clients and Servers.
  2. Implementation of RPC. Stub generation, marshaling arbitrary data structures. External data representation (XDR) and RPCGEN. Study of an RPC example.
  3. Remote Method Invocation (RMI) and Object Serialization of Java.

2.10.1 Refs

  1. Andrew D. Birrell and Bruce Jay Nelson, Implementing Remote Procedure Calls, ACM Transactions on Computer Systems (TOCS), 2, 1, pp. 39–59, 1984. A classic paper.
  2. Oracle.com, ONC+ Developer's Guide; http://docs.sun.com/app/docs/doc/816-1435; Reference. This is a highly recommended complete book on RPC.
  3. https://www.cs.princeton.edu/courses/archive/fall16/cos418/docs/L3-rpc.pdf Slides on Distributed Programming and Remote Procedure Calls (RPC)
  4. Java tutorial, http://download.oracle.com/javase/tutorial/ Focus on the RMI trail.
  5. Andrews, Chapter 9.

2.11 Distributed Algorithms (6)

  1. CSP (Communicating Sequential Processes).
  2. Asynchronous and synchronous message passing.
  3. Logical clocks, ordering of events.
  4. Heartbeat, probe/echo, and broadcast algorithms.
  5. Distributed Mutual Exclusion.
  6. Implementation of Distributed Semaphores.
  7. Distributed Termination Detection.

2.11.1 Refs

  1. C. A. R. Hoare, "Communicating Sequential Processes,'' Communications of the ACM, 1978, Vol. 21, No. 8, 666-677. http://www.usingcsp.com/ has an entire free book by Hoare describing further developements. Hoare is a Turing Award Winner.
  2. Andrews, Chapters 7 and 8.

2.12 Distributed Languages and Systems (8)

  1. SR: Multiple primitives,
  2. Linda: Distributed data structures, and
  3. Java, and JavaSpaces,
  4. Actors + Akka.
  5. Distributed PLs: Erlang, Go, Scala.
  6. Distributed File Systems, IPFS

2.12.1 Refs

  1. Andrews, Chapter 10.
  2. Sudhir Ahuja, Nicholas Carriero and David Gelernter, "Linda and Friends,'' IEEE Computer (magazine), Vol. 19, No. 8, 26-34. http://www.lindaspaces.com/ has an entire book.
  3. JavaSpaces http://en.wikipedia.org/wiki/Tuple_space
  4. GO https://tour.golang.org/concurrency/1 Goroutines and https://tour.golang.org/concurrency/2 Channels
  5. Books and Docs on Akka

2.13 Semantics of Concurrency (4)

  1. Programming logic. Axiomatic Semantics.
  2. Assertions on process states.
  3. Pre-, post conditions, and loop invariants.
  4. Temporal logic.

2.13.1 Refs

  1. Mateti, Lecture Notes on ../FormalMethods/
  2. Andrews, Chapter 2.
  3. http://www.tlaplus.net/ TLA "is a logic … that consist[s] mainly of ordinary (non-temporal) mathematics with just a tiny bit of temporal logic." Lamport is a 2013 Turing Award winner.

3 Grading

3.1 Exams 25+35%

  1. Two exams. Most likely take-home. But, without searching the web or whatever for answers. Honor code expected.

3.2 Discussion Forum 5%

  1. https://piazza.com/wright/spring2020/ceg7370/home [Will rename soon.]
  2. Piazza is our discussion platform.

3.3 Projects 35%

  1. Projects P0 .. P3 5+10+10+10%
  2. P0 src code bundle is given. Show that you can build and run it.
  3. P1 in C++, P2 in Java, P3 in Akka. All are extensions of P0.
  4. Projects [For full details click this link.]

3.4 Home Work 0%

  1. Homework will be given. But neither collected nor graded. Implies that you will work on various things on your own and discuss.
  2. Homework for this week, as a sample:
  3. Learn the Mine Sweeper game. Imagine each cell is a computer system. A cell talks to neighbors only through message passing. How do we program it?

4 Survey of Prerequisites

  1. We will try to fill you in on most of the prerequisites. The survey is for that purpose. In some ways it may be better that you have not heard of some of these things.
  2. Post on Piazza as well as interact now to this Survey of Prerequisites.

4.1 Survey: Concepts from Concurrency

  1. How familiar are you with: critical sections, mutual exclusion, message passing, synchronization, fairness, starvation, non-determinism?
  2. Can you differentiate deadlocks from livelocks? safety from liveness?

4.2 Survey: Constructs from Concurrent Programming

  1. How familiar are you with: Critical Regions, Monitors, binary and general Semaphores?
  2. How familiar are you with IPC mechanisms of Linux?

4.3 Survey: Classic Problems

  1. How familiar are you with: Producers and Consumers, Readers and Writers, Dining Philosphers, Roll-Your-Own Cigarette Smoking, Sleeping Barber, Drinking Philosophers.

4.4 Survey: Formal Semantics

  1. How familiar are you with: assertions, pre- post-conditions, loop and class invariants.
  2. How familiar are you with: Happened Before?
  3. How familiar are you with: Propositions, Predicates and Temporal Logic?

4.5 Survey: Program Development

  1. How long is the longest C/C++ program that you have written individually?
  2. Same question but with Java.
  3. Same question but with Scala. (Very possible that you have done nothing with this language.)
  4. How familiar are you with make, ant, maven, gradle, and various build-tools?
  5. What IDEs have you used and for how long? E.g., idea/ eclipse/ netbeans/ other-IDEs. On Linux? On Windows?

5 Course Lecture Samples

​1. We are picky about our terms. Ex: "Process"

  1. All the following are conceptually the same: process, thread, task, job, …
  2. On a given platform (e.g., Linux): process v thread v … are different
  3. By def: a single process is sequential
  4. Muliprocess v Multiprocessor v Multi-core: Same? Similar?

5.1 Concurrency Fundamentals #1: Non-Determinacy

  1. Ex: Consider the simple assignment statement
    1. {x := 3 [] 7} (Note the fat-bar)
    2. What is the value of x?
    3. Either 3 or 7; nothing else; but which??
    4. Code better be prepared for either.
  2. The above computation P is non-determinant. Each time we run, the result of P may change "for no good reason." Why? Because "non-determinacy" [] is baked in.

5.2 Concurrency Fundamentals #2: Meta Terminology

  1. Fundamentals v Principles v Foundations
  2. Concurrency Fundamentals constitute the core of this course.
  3. Until the last week of this course, we will use concurrency as a term covering all of networked-, parallel-, and distributed- computing.

5.3 Semaphores Defs

  1. A semaphore s is an OOP ADT (abstract data type) variable. It has an integer private data member s, only operable with two public methods called P and V, apart from being initialized.
  2. P(s) ≡ ‹ await s > 0 → s := s-1 ›
  3. V(s) ≡ ‹ s := s+1 ›
  4. The complications in the defs are (i) the atomic angular-brackets and (ii) the meaning of await.

5.4 Starvation-Free Mutual Exclusion

  1. {semaphore m := 1; P(m); Process-i; V(m)}
  2. This is starvation-prone in a distributed context.
  3. Designing starvation-free solutions is part of this course.

5.5 Starvation-Free MutEx: One Solution Idea

starv-free.jpg

  1. The dots are processes. The thick-rectangles are gates letting in one process at a time. The black rectangle is where we require starve-free mutex. A process finishing this will exit as the black dot did, skipping over the black-, red- and green boundaries.
  2. What is the rest of the "idea"?

5.6 Axiomatics #1

  1. Axiomatics is a way of defining the meaning of PL constructs, in a way much better than English prose.
  2. Notationally, we use the triplet < P, S, Q > where P and Q are assertions (True/False Boolexp) on process state, S is a piece of code.
  3. Q describes the state after S completed. It assumes that P was true when code S started.
  4. P is called a pre-condition. Q is called a post-condition.

5.7 Axiomatics #2

  1. Here is an example applied to semaphore def.
  2. P(s) can be defined as follows: Given [(R and s > 0) ⇒ Q(s, s-1)], we can conclude <R, P(s), Q>
  3. V(s) can be defined as follows: Given [R ⇒ Q(s, s+1), we can conclude <R, V(s), Q>
  4. There will be considerable discussion on this.

5.8 Project on RPC #1

  1. RPC Architecture [We will go over this in considerable detail.]

rpc-diag-tikz.jpg

5.9 Project on RPC #2 Marshalling/ Serializing

  1. How do we send data structures that contain links/addresses to machines across the network?

rpc-marshalling-tikz.jpg

5.10 Actors

  1. An actor is an extremely light weight process communicating with other actors through mailboxes. No shared variables.

fig-actors.jpg

Figure 4: Carl Hewitt's Actors

5.11 Dining Philosophers in Akka

dining-philosophers.png

A problem created to illustrate concurrency issues. In our course, we wish to do this in Scala with Akka actors.

5.12 Distributed File Systems

  1. DFS: A file volume spatially distributed over many machines.
  2. Requirements: Transparency, Concurrency, Replication, Heterogeneity, Fault tolerance, Consistency, Security, Efficiency.
  3. Fault tolerance == Robustness, 24x7: Immune to (individual) machine failures. cf. CAP "theorem".

5.13 IPFS

  1. Inter Planetary File System [Ha ha! For now, only on earth.]
  2. https://ipfs.io/ [Do click] "IPFS powers the Distributed Web"
  3. Involves Blockchain and Filecoin.
  4. Link to Mateti's lectures ../DistFileSys/IPFS/ [Not expected to click today]

6 References

  1. I will list specific chapters from Recommended Books later. See also Source Materials #1 Books and Source Materials #2 On Line.
  2. M. Ben-Ari, Principles of Concurrent and Distributed Programming, Addison-Wesley/Pearson, 2006. {Another classic.}
  3. George Coulouris, Jean Dollimore, Tim Kindberg, and Gordon Blair, Distributed Systems: Concepts and Design, 2011. {Systems as opposed to principles, and foundations.}

6.1 ACK

  1. RevealJS: This presentation was made with https://revealjs.com, a FOSS HTML Presentation Framework
  2. Nearly all figures are borrowed from the web

Copyright © 2020 • pmateti@iiitd.ac.in • 2020-01-02