DISTRIBUTED MUTEX. EE324 Lecture 11

Similar documents
EE324 INTRO. TO DISTRIBUTED SYSTEMS LECTURE 13 TRANSACTIONS

Coordination 1. To do. Mutual exclusion Election algorithms Next time: Global state. q q q

Distributed Systems (5DV147)

Frequently asked questions from the previous class survey

CS455: Introduction to Distributed Systems [Spring 2018] Dept. Of Computer Science, Colorado State University

Chapter 6 Synchronization

CSE 5306 Distributed Systems. Synchronization

Mutual Exclusion. A Centralized Algorithm

Distributed Systems. coordination Johan Montelius ID2201. Distributed Systems ID2201

Last Class: Clock Synchronization. Today: More Canonical Problems

Distributed Synchronization. EECS 591 Farnam Jahanian University of Michigan

CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [DISTRIBUTED MUTUAL EXCLUSION] Frequently asked questions from the previous class survey

Clock Synchronization. Synchronization. Clock Synchronization Algorithms. Physical Clock Synchronization. Tanenbaum Chapter 6 plus additional papers

CS455: Introduction to Distributed Systems [Spring 2018] Dept. Of Computer Science, Colorado State University

Process Synchroniztion Mutual Exclusion & Election Algorithms

Advanced Topics in Distributed Systems. Dr. Ayman A. Abdel-Hamid. Computer Science Department Virginia Tech

CSE 5306 Distributed Systems

Distributed Systems (5DV020) Group communication. Fall Group communication. Fall Indirect communication

Distributed Systems. Lec 9: Distributed File Systems NFS, AFS. Slide acks: Dave Andersen

CSE 486/586 Distributed Systems

Distributed Mutual Exclusion

PROCESS SYNCHRONIZATION

殷亚凤. Synchronization. Distributed Systems [6]

Coordination and Agreement

Verteilte Systeme (Distributed Systems)

Synchronization. Clock Synchronization

Several of these problems are motivated by trying to use solutiions used in `centralized computing to distributed computing

Synchronization. Distributed Systems IT332

CMPSCI 677 Operating Systems Spring Lecture 14: March 9

Distributed Operating Systems. Distributed Synchronization

SYNCHRONIZATION. DISTRIBUTED SYSTEMS Principles and Paradigms. Second Edition. Chapter 6 ANDREW S. TANENBAUM MAARTEN VAN STEEN

Synchronization Part 2. REK s adaptation of Claypool s adaptation oftanenbaum s Distributed Systems Chapter 5 and Silberschatz Chapter 17

A Two-Layer Hybrid Algorithm for Achieving Mutual Exclusion in Distributed Systems

CSE 124: LAMPORT AND VECTOR CLOCKS. George Porter October 30, 2017

Control. CS432: Distributed Systems Spring 2017

Slides for Chapter 15: Coordination and Agreement

Chapter 6 Synchronization (2)

Last Class: Naming. Today: Classical Problems in Distributed Systems. Naming. Time ordering and clock synchronization (today)

Event Ordering. Greg Bilodeau CS 5204 November 3, 2009

OUTLINE. Introduction Clock synchronization Logical clocks Global state Mutual exclusion Election algorithms Deadlocks in distributed systems

Distributed Systems (5DV147)

Arranging lunch value of preserving the causal order. a: how about lunch? meet at 12? a: <receives b then c>: which is ok?

Distributed Mutual Exclusion Algorithms

Distributed Systems (5DV147)

Synchronization. Chapter 5

CMSC 714 Lecture 14 Lamport Clocks and Eraser

Silberschatz and Galvin Chapter 18

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Lecture 7: Logical Time

Algorithms and protocols for distributed systems

TIME ATTRIBUTION 11/4/2018. George Porter Nov 6 and 8, 2018

Midterm Examination ECE 419S 2015: Distributed Systems Date: March 13th, 2015, 6-8 p.m.

Distributed Systems Coordination and Agreement

Distributed Systems Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2016


Distributed Systems Exam 1 Review Paul Krzyzanowski. Rutgers University. Fall 2016

Operating Systems. Mutual Exclusion in Distributed Systems. Lecturer: William Fornaciari

CS140 Operating Systems and Systems Programming Midterm Exam

2. Time and Global States Page 1. University of Freiburg, Germany Department of Computer Science. Distributed Systems

Homework #2 Nathan Balon CIS 578 October 31, 2004

CSE 380 Computer Operating Systems

Time Synchronization and Logical Clocks

Dining Philosophers, Semaphores

Time in Distributed Systems

What is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem?

Lecture 6: Logical Time

Clock and Time. THOAI NAM Faculty of Information Technology HCMC University of Technology

Concurrency: Mutual Exclusion and Synchronization

Exam 2 Review. Fall 2011

ECE 612: Embedded and Real-Time Systems

Transactions with Replicated Data. Distributed Software Systems

Concurrency Control Algorithms

Synchronization (contd.)

Synchronisation in. Distributed Systems. Co-operation and Co-ordination in. Distributed Systems. Kinds of Synchronisation. Clock Synchronization

Middleware and Interprocess Communication

Distributed Systems. Pre-Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2015

ICT 6544 Distributed Systems Lecture 7

Distributed Coordination! Distr. Systems: Fundamental Characteristics!

Lecture 10: Clocks and Time

Distributed Systems COMP 212. Lecture 1 Othon Michail

How Bitcoin achieves Decentralization. How Bitcoin achieves Decentralization

CMSC 412. Announcements

Operating Systems. Deadlock. User OS. Kernel & Device Drivers. Interface Programs. Brian Mitchell - Operating Systems

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

Specifying and Proving Broadcast Properties with TLA

Lecture 9: Midterm Review

Concurrency: Mutual Exclusion and

Distributed Coordination 1/39

Distributed Deadlocks. Prof. Ananthanarayana V.S. Dept. of Information Technology N.I.T.K., Surathkal

OPERATING SYSTEMS. Deadlocks

Kingdom of Saudi Arabia Ministry of Higher Education College of Computer & Information Sciences Majmaah University. Course Profile

Chapter 16: Distributed Synchronization

Deadlock and Monitors. CS439: Principles of Computer Systems September 24, 2018

SEGR 550 Distributed Computing. Final Exam, Fall 2011

Distributed Systems Question Bank UNIT 1 Chapter 1 1. Define distributed systems. What are the significant issues of the distributed systems?

Distributed Systems COMP 212. Lecture 17 Othon Michail

Synchronization Part II. CS403/534 Distributed Systems Erkay Savas Sabanci University

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

Recap: Consensus. CSE 486/586 Distributed Systems Mutual Exclusion. Why Mutual Exclusion? Why Mutual Exclusion? Mutexes. Mutual Exclusion C 1

Chapter 18: Distributed

Transcription:

DISTRIBUTED MUTEX EE324 Lecture 11

Vector Clocks Vector clocks overcome the shortcoming of Lamport logical clocks L(e) < L(e ) does not imply e happened before e Goal Want ordering that matches causality V(e) < V(e ) if and only if e e Method Label each event by vector V(e) [c 1, c 2, c n ] c i = # events in process i that causally precede e

Vector Clock Algorithm Initially, all vectors [0,0,,0] For event on process i, increment own c i Label message sent with local vector When process j receives message with vector [d 1, d 2,, d n ]: Set local each local entry k to max(c k, d k ) Increment value of c j

Vector Clocks 4 Vector clocks overcome the shortcoming of Lamport logical clocks L(e) < L(e ) does not imply e happened before e Vector timestamps are used to timestamp local events They are applied in schemes for replication of data

Vector Clocks 5 At p 1 a occurs at (1,0,0); b occurs at (2,0,0); piggyback (2,0,0) on m 1 At p 2 on receipt of m 1 use max ((0,0,0), (2,0,0)) = (2, 0, 0) and add 1 to o wn element = (2,1,0) Meaning of =, <=, max etc for vector timestamps compare elements pairwise

Vector Clocks 6 Note that e e implies L(e)<L(e ). The converse is also true Can you see a pair of parallel events? c e( parallel) because neither V(c) <= V(e) nor V(e) <= V(c)

Figure 14.6 Lamport timestamps for the events shown in Figure 14.5 Instructor s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 Pearson Education 2012

Figure 14.7 Vector timestamps for the events shown in Figure 14.5 Instructor s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 Pearson Education 2012

Logical clocks including VC doesn t capture everything Out-of-band communication

Distributed Mutex (Reading CDK5 15.2) We learned about mutex, semaphore, and CVs within a single system. What do they have in common? They require a shared state and we kept it in the memory. Distributed mutex No shared memory How do we implement it? Message passing Challenges: Message can be dropped and processes can fail.

Distributed Mutex (Reading CDK5 15.2) Entering/leaving a critical section Enter() --- block if neccessary ResourceAccessses() --- access shared resource (in side the CS) Leave() Goal Safety: at most one process may execute in the CS at one time Liveness: Requests to enter/exit CS eventually succeeds. (no deadlock or starvation) ordering: If one entry request happened before another, then entry to CS must happen in that order.

Distributed Mutex (Reading CDK5 15.2) ordering Example explained in class Other performance objectives Reduce the number of messages Minimize synchronization delay

13 Mutual Exclusion A Centralized Algorithm 1. Process 1 asks the coordinator for permission to access a shared reso urce Permission is granted 2. Process 2 then asks permission to access the same resource The co ordinator does not reply 3. When process 1 releases the resource, it tells the coordinator, which t hen replies to 2

Mutual Exclusion A Centralized Algorithm Advantages Simple, small delay (one RTT) to acquire mutex Only 3 messages required to enter and leave the critical section Disadvantages Single point of failure Central performance bottleneck Does not ensure ordering (example?) Must elect a master in a consistent fashion

A Token Ring Algorithm 15 An unordered group of processes on a network A logical ring constructed in software Use ring to pass right to access resource

A Token Ring Algorithm Benefits: Simple Problems: Failure recovery can be difficult. A single process failure can break the ring. But, a failure can be recovered by dropping the process in the logical ring. Does not ensure ordering Long synchronization delay: Need to wait for up to N-1 messages, for N processors

Lamport s Shared Priority Queue Maintain a global priority queue of requests for the critical section. But each process has its own queue. The ordering inside the Qs is enforced by Lamport s clock. Thus, we enforce ordering.

Lamport s Shared Priority Queue Each process i locally maintains Qi (its own version of the priority Q) To execute critical section, you must have replies from all other processes AND your request must be at the front of Qi When you have all replies: All other processes are aware of your request (because the request happens before response) You are aware of any earlier requests (assume messages from the same process are not reordered)

Lamport s Shared Priority Queue To enter critical section at process i :Stamp your request with the current time T Add request to Qi Broadcast REQUEST(T) to all processes Wait for all replies and for T to reach front of Qi To leave Pop head of Qi, Broadcast RELEASE to all processes On receipt of REQUEST(T ) from process j: Add T to Qi If waiting for REPLY from j for an earlier request T, wait until j replies to you Otherwise REPLY On receipt of RELEASEPop head of Qi

Lamport s Shared Priority Queue Advantages: Fair Short synchronization delay Disadvantages: Very unreliable (Any process failure halts progress) 3(N-1) messages per entry/exit

Announcements Midterm In the process of making it. Written exam: take home exam. Honor code. Only textbook and lecture notes. No discussion. No Internet. Release at noon 10/24. Due Friday evening 10/25 Programming part: Can use the Internet, but no discussion.