Hello all,
It is generally thought that context switching is expensive and should be
avoided. Does anyone have any current performance measurements in this area on
multicore machines?
The leader/follower pattern is an attempt to minimize context switching.
Leader/follower is easy to think about in a ReaderThread/WorkerThread
implementation:
1. The ReaderThread blocks waiting for input.
2. When input arrives the ReaderThread morphs to a WorkerThread and a new/pooled
thread takes over the ReaderThread role.
But how does this pattern fit a SelectorThread/WorkerThread implementation?
When the SelectorThread unblocks it might unblock with *several* events, so it
just can't morph into a WorkerThread --- there is work for each event, and some
events might be short and done by the SelectorThread while others need a true
WorkerThread.
I suppose if there is only one event and that event needs its own thread, then
the SelectorThread could morph into a WorkerThread and a new/pooled thread would
take over as Selector.
Would the above even be worth it?
What does Grizzly do at this time?
Regards,
Harold