← Lessons

quiz vs the machine

Gold1380

Concurrency

Message Passing Semantics

Delivery guarantees decide what your protocol must tolerate.

5 min read · core · beat Gold to climb

Sharing memory versus passing messages

In message passing, units communicate by sending copies of data rather than touching shared memory. Because nothing is shared, there is no shared write to synchronize. The hard questions move to delivery guarantees.

The delivery spectrum

  • At most once. A message may be lost but is never duplicated. Simple, but you can drop work.
  • At least once. A message is retried until acknowledged, so it may arrive twice. Receivers must be idempotent.
  • Exactly once. The ideal, but it requires deduplication state and acknowledgements; truly end to end exactly once is hard.

Ordering

Many systems guarantee order only per sender to receiver pair, not globally. If two senders message the same actor, their messages can interleave in any way. Protocols that depend on order must carry sequence numbers.

Sync versus async

A synchronous send blocks until the receiver is ready, which couples timing. An asynchronous send drops the message into a buffer and returns, decoupling sender from receiver at the cost of buffering and backpressure concerns.

Key idea

Message passing replaces shared memory with copies, so correctness hinges on delivery guarantees and ordering rather than locks.

Check yourself

Answer to earn rating on the learn ladder.

1. Under at least once delivery, what must receivers be?

2. What ordering is commonly guaranteed in message passing systems?