MPRI – Course on Concurrency Probabilistic methods in Concurrency Catuscia Palamidessi INRIA Futurs and LIX

Slides:



Advertisements
Similar presentations
08 April PPS - Groupe de Travail en Concurrence The probabilistic asynchronous -calculus Catuscia Palamidessi, INRIA Futurs, France.
Advertisements

N-Consensus is the Second Strongest Object for N+1 Processes Eli Gafni UCLA Petr Kuznetsov Max Planck Institute for Software Systems.
Operating Systems Lecture Notes Deadlocks Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Paris, 3 Dec 2007MPRI Course on Concurrency MPRI – Course on Concurrency Lecture 12 Probabilistic process calculi Catuscia Palamidessi LIX, Ecole Polytechnique.
JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
Liveness and Performance Issues
Snap-stabilizing Committee Coordination Borzoo Bonakdarpour Stephane Devismes Franck Petit IEEE International Parallel and Distributed Processing Symposium.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Distributed Algorithms – 2g1513 Lecture 10 – by Ali Ghodsi Fault-Tolerance in Asynchronous Networks.
Outline. Theorem For the two processor network, Bit C(Leader) = Bit C(MaxF) = 2[log 2 ((M + 2)/3.5)] and Bit C t (Leader) = Bit C t (MaxF) = 2[log 2 ((M.
Critical Section chapter3.
Chapter 3 The Critical Section Problem
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
Process Algebra (2IF45) Probabilistic Process Algebra Suzana Andova.
SPL/2010 Liveness And Performance 1. SPL/2010 Performance ● Throughput - How much work can your program complete in a given time unit? ● Example: HTTP.
Probabilistic Methods in Concurrency Lecture 9 Other uses of randomization: a randomized protocol for anonymity Catuscia Palamidessi
Bangalore, 2 Feb 2005Probabilistic security protocols 1 CIMPA School on Security Specification and verification of randomized security protocols Lecture.
Probabilistic Methods in Concurrency Lecture 3 The pi-calculus hierarchy: separation results Catuscia Palamidessi
Course on Probabilistic Methods in Concurrency (Concurrent Languages for Probabilistic Asynchronous Communication) Lecture 1 The pi-calculus and the asynchronous.
Starvation and Deadlock
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
1 Basic abstract interpretation theory. 2 The general idea §a semantics l any definition style, from a denotational definition to a detailed interpreter.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Chapter 4 - Self-Stabilizing Algorithms for Model Conservation4-1 Chapter 4: roadmap 4.1 Token Passing: Converting a Central Daemon to read/write 4.2 Data-Link.
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.
Avishai Wool lecture Introduction to Systems Programming Lecture 4 Inter-Process / Inter-Thread Communication.
Randomized and Quantum Protocols in Distributed Computation Michael Ben-Or The Hebrew University Michael Rabin’s Birthday Celebration.
Process Synchronization
The k-server Problem Study Group: Randomized Algorithm Presented by Ray Lam August 16, 2003.
Expanders Eliyahu Kiperwasser. What is it? Expanders are graphs with no small cuts. The later gives several unique traits to such graph, such as: – High.
CS 603 Dining Philosopher’s Problem February 15, 2002.
© 1997 UW CSE 11/13/97N-1 Concurrency Control Chapter 18.1, 18.2, 18.5, 18.7.
 Jim has six children.  Chris fights with Bob,Faye, and Eve all the time; Eve fights (besides with Chris) with Al and Di all the time; and Al and Bob.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
MATH 224 – Discrete Mathematics
Probabilistic Methods in Concurrency Lecture 4 Problems in distributed systems for which only randomized solutions exist Catuscia Palamidessi
11 February CdP INRIA Futurs Catuscia Palamidessi INRIA Saclay.
CS 153 Design of Operating Systems Spring 2015 Lecture 11: Scheduling & Deadlock.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 10 Instructor: Haifeng YU.
10 December 2002ENS Cachan1 Generalized dining philosophers Catuscia Palamidessi, INRIA in collaboration with Mihaela Oltea Herescu, IBM Michael Pilquist,
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Classical problems.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 8 Instructor: Haifeng YU.
Distributed Algorithms Lecture 10b – by Ali Ghodsi Fault-Tolerance in Asynchronous Networks – Probabilistic Consensus.
By J. Burns and J. Pachl Based on a presentation by Irina Shapira and Julia Mosin Uniform Self-Stabilization 1 P0P0 P1P1 P2P2 P3P3 P4P4 P5P5.
Probabilistic Anonymity Mohit Bhargava, IIT New Delhi Catuscia Palamidessi, INRIA Futurs & LIX.
MPRI 3 Dec 2007Catuscia Palamidessi 1 Why Probability and Nondeterminism? Concurrency Theory Nondeterminism –Scheduling within parallel composition –Unknown.
MPRI – Course on Concurrency Lectures 11 and 12 The pi-calculus expressiveness hierarchy Catuscia Palamidessi INRIA Futurs and LIX
Chapter 11 Resource Allocation by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch.
14 October BASICS'09, Shanghai On the expressive power of synchronization primitives in the π-calculus Catuscia Palamidessi, INRIA Saclay, France.
Chapter 21 Asynchronous Network Computing with Process Failures By Sindhu Karthikeyan.
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
“Towards Self Stabilizing Wait Free Shared Memory Objects” By:  Hopeman  Tsigas  Paptriantafilou Presented By: Sumit Sukhramani Kent State University.
Probabilistic Methods in Concurrency Lecture 6 Progress statements: A tool for verification of probabilistic automata Catuscia Palamidessi
6 October PPDP / GPCE 2002 Mobile Calculi Catuscia Palamidessi, INRIA Futurs, France joint work with Mihaela Herescu, IBM, Austin for Distributed.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. Fast.
1 Distributed Vertex Coloring. 2 Vertex Coloring: each vertex is assigned a color.
Semaphores Chapter 6. Semaphores are a simple, but successful and widely used, construct.
Lecture 4 1 Honnor Projects Supervised by Catuscia Palamidessi The  -calculus, a small language for specification and verification of concurrency and.
16 January 2004LIX1 Equipe Comète Concurrency, Mobility, and Transactions Catuscia Palamidessi INRIA-Futurs and LIX.
Krishnendu ChatterjeeFormal Methods Class1 MARKOV CHAINS.
Catuscia Palamidessi, INRIA Saclay, France
Probabilistic Methods in Concurrency Lecture 5 Basics of Measure Theory and Probability Theory Probabilistic Automata Catuscia Palamidessi
Liveness And Performance
Probabilistic Methods in Concurrency Lecture 7 The probabilistic asynchronous p-calculus Catuscia Palamidessi
Netzer & Miller 1990: On the Complexity of Event Ordering for Shared-Memory Parallel Program Executions.
Instructor: Aaron Roth
Presentation transcript:

MPRI – Course on Concurrency Probabilistic methods in Concurrency Catuscia Palamidessi INRIA Futurs and LIX Page of the course:

PPS, 13 Jan 2005Probabilistic methods in Concurrency2 Filling the gap between the  -calculus and the asynchronous  -calculus The  -calculus is strictly more expressive than the asynchronous  -calculus On the other hand, the asynchronous  -calculus can be implemented in a distributed way while the (synchronous)  - calculus cannot It is possible to enrich the asynchronous  -calculus with a mechanism of probabilistic (internal) choice so to achieve the same expressive power than the  -calculus The idea is to implement the mixed choice construct via a randomized algorithm which is based on an extension of the solution of Lehmann and Rabin to the Dining Philosophers

PPS, 13 Jan 2005Probabilistic methods in Concurrency3 The dining philosophers Each philosopher needs exactly two forks Each fork is shared by exactly two philosophers A philosopher can access only one fork at the time

PPS, 13 Jan 2005Probabilistic methods in Concurrency4 Deadlock freedom (aka progress): if there is a hungry philosopher, a philosopher will eventually eat Starvation freedom: every hungry philosopher will eventually eat (but we won’t consider this property here) Robustness wrt a large class of adversaries: Adversaries decide who does the next move (schedulers) Fully distributed: no centralized control or memory Symmetric: –All philosophers run the same code and are in the same initial state –The same holds for the forks Intended properties of solution

PPS, 13 Jan 2005Probabilistic methods in Concurrency5 Non-existence of a “deterministic” solution Lehman and Rabin have shown that there does not exist a “deterministic” (i.e. non-probabilistic) solution to the dining philosophers, satisfying all properties listed in previous slide. The proof proceeds by proving that for every possible program we can define an adversary (scheduler) which preserves the initial symmetry Note: Francez and Rodeh did propose a “deterministic” solution using CSP, similar to the solution in CCS seen in Lecture 6. The explanation to this apparent contradiction is that CSP cannot be implemented in a fully distributed way

PPS, 13 Jan 2005Probabilistic methods in Concurrency6 The probabilistic algorithm of Lehmann and Rabin 1.think 2.randomly choose fork in {left, right} %commit 3.if taken(fork) then goto 3 else take(fork) 4.if take(other(fork)) then {release(fork); goto 2} else take(other(fork)) 5.eat 6.release(other(fork)) 7.release(fork) 8.goto 1

PPS, 13 Jan 2005Probabilistic methods in Concurrency7 Correctness of the algorithm of Lehmann and Rabin Theorem: for every fair adversary, if a philosopher becomes hungry, then a philosopher (not necessarily the same) will eventually eat with probability 1. Proof The original proof is not fully formalized and it is difficult to follow. There is a proof by Segala and Lynch, using progress statements, which is easier Question: why the fairness requirement? Can we write a variant of the algorithm which does not require fairness?

PPS, 13 Jan 2005Probabilistic methods in Concurrency8 Progress statements –Proposed by Lynch and Segala –A formal method to analyze probabilistic algorithms Definition (progress statements) –Given sets of states S, T, and a class of adversaries A, we write S –A,p-> T if, under any adversary in A, from any state in S, we eventually reach a state in T with probability at least p –Furthermore, we write S unless T if, whenever from a state in S we do not reach a state in T, we remain in S (possibly in a different state of S)

PPS, 13 Jan 2005Probabilistic methods in Concurrency9 History insensitivity Definition: A class of adversaries A is history- insensitive iff for every adversary  A and every execution fragment e, there exists an adversary  ’  A such that for every execution fragment e’,  (ee’) =  ’(e’) holds Proposition: The class of fair adversaries is history- insensitive Proof: If  is fair, then for every e, the adversary  ’ defined as  ’(e’) =  (ee’) is still fair.

PPS, 13 Jan 2005Probabilistic methods in Concurrency10 Progress statements Some useful properties –If A is history-insensitive, S –A,p-> T, and T –A,q-> U, then S –A,pq-> U –If S 1 –A,p 1 -> T 1, and S 2 –A,p 2 -> T 2, then S 1  S 2 –A,p-> T 1  T 2 where p = min{p 1,p 2 } –S –A,1-> S –If A is history-insensitive and S –A,p-> T and S unless T, and p > 0, then S –A,1-> T

PPS, 13 Jan 2005Probabilistic methods in Concurrency11 Proof of deadlock-freedom for the algorithm of Lehmann and Rabin We will show that under a fair adversary scheduler we have deadlock-freedom (and livelock-freedom), i.e. if a philosopher gets hungry, then with probability 1 some philosopher (not necessarily the same) will eventually eat. In this proof we will use the progress statements.

PPS, 13 Jan 2005Probabilistic methods in Concurrency12 State action description R think or reminder region get hungry F flip ready to toss W wait waiting for first fork Ssecondchecking second resource Ddropdropping first resource Peatpre-critical region Cexitcritical region E F dropFdrop first fork E S dropSdrop second fork E R remmove to reminder region States and actions in the algorithm of Lehmann and Rabin T T

PPS, 13 Jan 2005Probabilistic methods in Concurrency13 Proof of deadlock freedom for the algorithm of Lehmann and Rabin Let us introduce the following global (sets of) states Try : at least one phil is in T={F,W,S,D,P} Eat : at least one phil is in C RT : at least one phil is in T, all the others are in T, R or E R Flip : at least one phil is in F Pre : at least one phil is in P Good : at least one process is in a ‘’good state’’, i.e. in {W,S} while his second fork f is not the first fork for the neighbor (i.e. the neighbor is not committed to f) We want to show that Try –A,1-> Eat for A = fair adv

PPS, 13 Jan 2005Probabilistic methods in Concurrency14 Proof of deadlock freedom for the algorithm of Lehmann and Rabin We can prove that, for the class of fair adversaries A (omitted in the following notation): –Try -1-> RT  Eat –RT -1-> Flip  Good  Pre –Flip -1/2-> Good  Pre –Good -1/4-> Pre –Pre -1-> Eat Using the properties of progress statements we derive Try -1/8-> Eat Since we also have Try unless Eat, we can conclude Try -1-> Eat

PPS, 13 Jan 2005Probabilistic methods in Concurrency15 Encoding  into  pa [[ ]] :    pa Fully distributed [[ P | Q ]] = [[ P ]] | [[ Q ]] Uniform [[ P  ]] = [[ P ]]  Correct wrt a notion of probabilistic testing semantics P must O iff [[ P ]] must [[ O ]] with prob 1

PPS, 13 Jan 2005Probabilistic methods in Concurrency16 Encoding  into  pa Idea: –Every mixed choice is translated into a parallel comp. of processes corresponding to the branches, plus a lock f –The input processes compete for acquiring both its own lock and the lock of the partner –The input process which succeeds first, establishes the communication. The other alternatives are discarded P Q R Pi Qi Ri f f f The problem is reduced to a generalized dining philosophers problem where each fork (lock) can be adjacent to more than two philosophers S R’i f Si

PPS, 13 Jan 2005Probabilistic methods in Concurrency17 Problems Wrt to our encoding goal, the algorithm of Lehmann and Rabin has two problems: 1.It works only for fair schedulers 2.It only works for certain kinds of graphs Problem 1 however can be solved easily by replacing the busy waiting in step 3 with suspension. [Duflot, Friburg, Picaronny 2002] – see also Herescu’s PhD thesis

PPS, 13 Jan 2005Probabilistic methods in Concurrency18 The algorithm of Lehmann and Rabin 1.think 2.randomly choose fork in {left, right} %commit 3.if taken(fork) then goto 3 else take(fork) 4.if take(other(fork)) then {release(fork); goto 2} else take(other(fork)) 5.eat 6.release(other(fork)) 7.release(fork) 8.goto 1

PPS, 13 Jan 2005Probabilistic methods in Concurrency19 The algorithm of Lehmann and Rabin modified so to eliminate the need of fairness 1.think 2.randomly choose fork in {left, right} %commit 3.if taken(fork) then wait 4.take(fork) 5.if take(other(fork)) then {release(fork); goto 2} else take(other(fork)) 6.eat 7.release(other(fork)) 8.release(fork) 9.goto 1

PPS, 13 Jan 2005Probabilistic methods in Concurrency20 Problem related to generic graphs In the general case, Each fork can be shared by more than two philosophers

PPS, 13 Jan 2005Probabilistic methods in Concurrency21 Dining philosophers on generic graphs Theorem: The algorithm of Lehmann and Rabin is deadlock-free if and only if all cycles are pairwise disconnected There are essentially three ways in which two cycles can be connected:

PPS, 13 Jan 2005Probabilistic methods in Concurrency22 Proof of the theorem If part) Each cycle can be considered separately. On each of them the classic algorithm is deadlock-free. Some additional care must be taken for the arcs that are not part of the cycle. Only if part) By analysis of the three possible cases. Actually they are all similar. We illustrate the first case taken committed

PPS, 13 Jan 2005Probabilistic methods in Concurrency23 Proof of the theorem (only-if part) The initial situation has probability p > 0 The scheduler forces the processes to loop Hence the system has a deadlock (livelock) with probability p Note that this scheduler is not fair. However we can define even a fair scheduler which induces an infinite loop with probability > 0. The idea is to have a scheduler that “gives up” after n attempts when the process keep choosing the “wrong” fork, but that increases (by f) its “stubborness” at every round. With a suitable choice of n and f we have that the probability of a loop is p/4

PPS, 13 Jan 2005Probabilistic methods in Concurrency24 Solution for the DP on generic graphs As we have seen, the algorithm of Lehmann and Rabin does not work on general graphs However, it is easy to modify the algorithm so that it works in general The idea is to reduce the problem to the pairwise disconnected cycles case: Each fork is initially associated with one token. Each phil needs to acquire a token in order to participate to the competition. After this initial phase, the algorithm is the same as the Lehmann & Rabin’s Theorem: The competing phils determine a graph in which all cycles are pairwise disconnected Proof: By case analysis. To have a situation with two connected cycles we would need a node with two tokens.

PPS, 13 Jan 2005Probabilistic methods in Concurrency25 Reduction to the classic case: each fork is initially associated with a token. Solution for the DP on generic graphs Each phil needs to acquire a token in order to participate to the competition. The competing phils determine a set of subgraphs in which each subgraph contains at most one cycle