[Gluster-devel] swapcontest usage in syncio.c

Anand Avati anand.avati at gmail.com
Thu Aug 9 04:56:00 UTC 2012


On Tue, Aug 7, 2012 at 1:45 PM, Jeff Darcy <jdarcy at redhat.com> wrote:

> On Tue, 7 Aug 2012 20:13:35 +0200
> manu at netbsd.org (Emmanuel Dreyfus) wrote:
>
> > Anand Avati <anand.avati at gmail.com> wrote:
> > What was behind the decision to use swapcontext, btw? Why not just
> > have a thread for each task?
>
> I should probably let the authors speak for themselves, but I suspect
> it's because operations like self-heal and rebalance can be expected to
> generate a *lot* of sync calls.  Threads do still consume non-trivial
> resources, and switches between them still involve a trip through the
> scheduler, even if they share an address space etc.  I just ran a quick
> experiment, and ping-ponging between tasks via swapcontext was ~9x as
> fast as via pthreads.  I didn't measure the effect on memory
> consumption, but it's likely to be at least as large as the effect on
> execution time.
>
>
That is largely the right reason. Pthreads are much more expensive than
context based "threads".

Avati
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20120808/b12b264d/attachment-0003.html>


More information about the Gluster-devel mailing list