It is very well-known that Vector clocks detect causal dependencies between events, but there are different implementation methods. What are the differences (advantages/disadvantages) between:
- ticking only when sending (before).
- ticking only when sending (after).
- ticking when receiving and ticking before sending
- ticking when receiving and ticking after sending
It is suppose to tick right before sending and also tick right before receiving. The word right before here means the event represented send/receive will have the vector clock timestamp of right after the vector clock has just been updated with a tick.
The reason is because there are 2 processes, the sender process and the receiver process.
It needs to tick the sending event so that the sender process is aware that a send event has just occurred. Correspondingly, it also needs to tick in the receiving event so that the receiver process is aware that a receive event has just occurred.
Otherwise, it would violate Lamport's happened before relation in either sender or receiver if a tick did not occur there.