[concurrency-interest] Re: leaders/followers pattern
dholmes at dltech.com.au
Thu Jun 9 00:07:40 EDT 2005
> Dawid Kurzyniec writes
> Actually I am with Mohan on this one. The point is to reduce response
> latency, i.e. eliminate the context switch on the path between receiving
> request (usually on the socket) and sending back the response.
Ah! - you are assuming that the leader can signal a new leader without
actually causing a context switch to that new leader prior to the processing
of the current event? That is certainly possible, but not guaranteed by any
Both designs cause the same *number* of context switches. But the *timing*
of those context switches depends on many things. Certainly in the
leader/follower pattern it is possible that a request may get responded to
without an intervening context switch, while with the hand-off to the worker
thread the request can not be responded to without the worker getting
switched in. So yes - the leader/follower pattern may provide better
response time, but not by reducing the number of context switches, but by
having them occur off the "critical path".
For a given system, with a regular event arrival distribution and processing
load, you could profile the two designs to see if one gives better overall
response time to individual requests.
More information about the Concurrency-interest