Mutual%20Exclusion - PowerPoint PPT Presentation

About This Presentation
Title:

Mutual%20Exclusion

Description:

a symmetrical, distributed algorithm cannot use fewer ... similar to Lamport's Bakery Algorithm. range never more than (N-1) can solve using modulo 2N ... – PowerPoint PPT presentation

Number of Views:141
Avg rating:3.0/5.0
Slides: 18
Provided by: csU73
Learn more at: http://www.cs.ucf.edu
Category:

less

Transcript and Presenter's Notes

Title: Mutual%20Exclusion


1
Mutual Exclusion
  • An Optimal Algorithm
  • For
  • Computer Networks

2
Assumptions Involved
  • communication by message passing
  • no shared memory
  • error free network links
  • node to node latency might vary
  • nodes are assumed to function properly

3
How is the Algorithm Optimal ?
  • a symmetrical, distributed algorithm cannot use
    fewer messages if requests are processed by each
    node concurrently
  • 2(N-1) messages for mutual exclusion
  • symmetrical ? same of msg. in/out of nodes
  • distributed ? running on all nodes in network
  • concurrently ? decision making is independent

4
Breaking Down the Node
  • 3 processes
  • wakes upon the need for mutual exclusion
  • receives and processes REQUEST messages
  • receives and processes REPLY messages
  • constant parameters
  • each node has a unique number ID
  • number of nodes in network N

5
Breaking Down the Node II
  • dynamic local parameters
  • int ourSequenceNum
  • int highestSequenceNum ? 0
  • int outstandingReplyCount
  • bool requestingCriticalSection
  • int 1-N replyDeferred ? FALSE
  • one semaphore
  • protect local shared variables of 3 processes

6
Process One -- invoke M.E. --
  • requestingCriticalSection TRUE
  • ourSequenceNum highestSequenceNum 1
  • outstandingReplyCount N 1
  • send REQUEST to all other nodes
  • wait( outstandingReplyCount 0 )
  • ENTER THE CRITICAL SECTION

7
Process 1 -- after CS --
  • LEAVE CRITICAL SECTION
  • requestingCriticalSection FALSE
  • send REPLY to all deferred nodes

8
Process 2 -- parses REQUEST --
  • update highestSequenceNum if required
  • determine who has priority
  • compare sequence number tie ? compare ID
  • if we have priority
  • make note of node ID to reply to later
  • if requesting node has priority
  • send a REPLY to node ID

9
Process 3 -- parse REPLY --
  • decrease outstandingReplyCount

10
REPLY Decision Table
11
Further Details
  • satisfies all three CS conditions
  • mutual exclusion
  • deadlock
  • starvation
  • unbounded sequence number count
  • similar to Lamports Bakery Algorithm
  • range never more than (N-1)
  • can solve using modulo gt 2N

12
New Node Joining Network
  • new node must have list of other nodes
  • new node must be inserted into other lists
  • contact a sponsor node already participatory
  • sponsor node will tell others using mutual
    exclusion
  • alternatively broadcast to all and await REPLYs

13
Node Leaving Network
  • notify all other nodes of intention
  • in itself considered a REPLY to requesting nodes
  • wait for REPLY from all nodes
  • do not invoke mutual exclusion during process

14
Node Restart and Failure
  • restart
  • restarting node first performs removal
  • next the node performs insertion
  • failure
  • must use some type of timeout-timer

15
Modifications
  • network supports broadcasting
  • message traffic reduces to (N)
  • implicit REPLY
  • approaches (N-1) messages with low CS activity
  • combination of the two above
  • can be as low as (1) messages

16
Readers / Writers Problem
  • writers
  • follow the original algorithm
  • will be given priority over readers
  • readers
  • always send REPLY
  • never defer a write REQUEST

17
History and Additional Info
  • if nodes act concurrently with NO access to
    timing-derived information, the algorithm in
    minimal time to obtain the mutual exclusion
  • the only earlier proposed mutual exclusion
    algorithm for computer networks is from Lamport
    and takes approximately 3(n-1) messages
Write a Comment
User Comments (0)
About PowerShow.com