General Algorithms Flashcards
Describe M.E token passing in a Ring-based algorithm
A mutual exclusion token (in the form of a message) is passed from process to process in a single direction (e.g. clockwise)
True or False?:
The ring topology is usually unrelated to the physical interconnections between the underlying computers
True
In a Ring-based algorithm what 3 actions can a process take when it receives the token?
♦if it does not need to enter the CS, it passes the token onto its neighbour
♦ if it does need to enter the CS, then it keeps the token
♦ to exit CS, it sends the token onto its neighbour
In Ricart and Agrawala’s algorithm what is the state at initialization?
On initialization
state := RELEASED;
In Ricart and Agrawala’s algorithm what happens when a process wishes to enter the CS?
To enter the critical section state := WANTED; Multicast request to all processes; T := request’s timestamp; Wait until (number of replies received = (N – 1)); state := HELD;
In Ricart and Agrawala’s algorithm what happens when a process receives a request to enter the CS?
On receipt of a request at pj (i ≠ j) if (state = HELD or (state = WANTED and (T, pj) < (Ti, pi))) then queue request from pi without replying; else reply immediately to pi; end if To exit the critical section state := RELEASED; reply to any queued requests;
Give a brief overview of Ricart and Agrawala’s algorithm.
Implements mutual exclusion between N peer
processes based upon multicast
Process requiring entry to a critical section multicasts
a request message
♦ Can enter the critical section only when all other
processes have replied to the message
What are Election algorithms?
Algorithms for choosing a unique process to play a particular role
In an election algorithm a process p can take which roles?
Be a participant – is engaged in some run of the election algorithm
Be a non-participant – not engaged in any election
Or has a variable elected(i), which will contain the identifier of the elected process
The elected process chosen will be the one with
the largest ‘identifier’. Give possible examples of identifiers
ID may be any useful value, as long as IDs are unique and totally ordered.
E.g. could elect the process with the lowest computational load by having each process use <1/load,i> as its identifier, where load > 0 and the index i is used to order identifiers with the same load
List Cristian’s algorithm for clock synchronisation for a process P, and a time server S — connected to a source of UTC.
- P requests the time from S
- After receiving the request from P, S prepares a response and appends the time T from its own clock.
- P then sets its time to be T + RTT/2