Totally Ordered Broadcast - Banking Example

Select the number of sites:


Select the algorithm to use in the simulation:



Select the speed of the simulation:








How to use the simulator

  1. Select the number of processes that you want to be present in the simulation.
  2. Select whether to implement the Totally Ordered Broadcast Algorithm
  3. Select the speed of the simulation, this can be changed after starting the animation but you have to click 'Pause/Resume Simulation' after changing from step to fast or slow.
  4. To pause the simulation with fast or slow speeds click on 'Pause/Resume Simulation'.
  5. To reset the simulation, click on 'Reset Simulation'.

Note: Changing the synchronization during execution will reset the simulation

About the Algorithm

The purpose of this algorithm is to ensure updates between processes execute in the order they were sent in. The algorithm accomplishes this by making use of an array of Lamport Timestamps and priority queues within each process. The local time of each process updates according to the highest timestamp attached to an incoming message. When a process receives a message, it broadcasts to all other processes. As a result, the local times propagate across the network. Messages in the priority queue are executed one at a time for all that is less than the current local time.

Pseudocode for sending an update U from process i:
 timestamp_array[i]++
 broadcast(U, timestamp_array[i])

Pseudocode for process i receiving an update from process j:
 timestamp_array[j] = msg_timestamp
 queue.enqueue(msg, msg.msg_timestamp)
 if msg_timestamp > timestamp_array[i]
   timestamp_array[i] = msg_timestamp
   broadcast(ack-msg, timestamp_array[i])
 end if

Pseudocode for applying updates:
 (update, timestamp) = queue.head()
 if (for all j, timestamp <= timestamp_array[j]))
   queue.dequeue()
   apply(update)
 end if