11 - Coordination Flashcards
Mutual Exclusion
Processes share a resource which must be exclusive access
Centralised algorithm
Single coordinator stores a queue and grants permission when applicable
Distributed Algorithm
Process sends message to all other processes (with res name, pID and logical timestamp)
Process returns OK if no interest in resource or is waiting with lower priority. Reply is deferred otherwise
High knowledge and comms requirement. Every process is a point of failure. Not scalable
Token Ring
Processes organised in logical ring
Token passed between them
Some topology knowledge. High comms due to constant passing of token. Problematic fault tolerance and limited scalability
Election Algorithm Requirements
Uniqueness (of a leader)
Termination (must end)
Agreement (for all processes)
Bully algorithm Strong assumptions
Each process knows all higher pID processes
Synchronous Comms - timeouts useful
Reliable message delivery
Processes allowed to crash
Bully algorithm
Elect active process with highest ID
Pk: ELECTION message is sent to all processes with higher IDs.
If no response then Pk wins and sends COORDINATOR message to all others.
If OK response, then Pk waits for COORDINATOR message or restarts election if timeout
Rough number of messages in bully algorithm
N^2
Ring Algorithm Assumptions
Processes in ring (knows successor)
Async comms enough
Reliable message delivery
Processes allowed to crash
Ring algorithm election
Any process starts by sending ELECTION to successor with a list
Receiver ACKs, passes it on with itself in the list
Once message returns, it sends COORDINATOR message around with list of all living processes
Highest pID is new coordinator
num of messages in ring algorithm
N messages
Election in Wireless assumtpions
Processes know current neighbors
Async comms enough (if neighbours are known, comms reliable and no crashing)
Reliable message delivery
Processes should not crash
Wireless Net Election
Elect most suitable process (eg with highest battery capacity)
Any process can broadscast ELECTION
if received for first time:
- set sender as parent
- Broadcast to neighbourhood N, not parent
- Wait until every process has ACK broadcast
- ACK to parent
- Recive info from each child
- Determine best process and send info to parent
Otherwise:
- ACK