Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160205095835.GH25193@example.net>
Date: Fri, 5 Feb 2016 10:58:35 +0100
From: u-uy74@...ey.se
To: musl@...ts.openwall.com
Subject: Re: setcontext/getcontext/makecontext missing?

On Thu, Feb 04, 2016 at 02:24:03PM -0500, Rich Felker wrote:
> > Pthreads feels like an overkill, hardly efficient when all one needs
> > is cooperative threading designed from the beginning to fit in one
> > process.

> the comparison is not between pure-userspace switching and having the
> kernel involved, but between a SYS_rt_sigprocmask syscall and a
> voluntary context switch between threads in the same process. The
> latter is extremely light and comparable to some of the cheapest
> syscalls, so I suspect the performance difference between ucontext and
> threads is negligible.

Thanks for pointing this out, if rt_sigprocmask can not be skipped
then indeed a switch becomes much more expensive.

> Given that there are a lot of other good
> reasons you should be using threads instead of ucontext, I think the
> matter is pretty clear.

Sure, the API was not exactly well thought-out.
Still I'd like to have a lighweight choice when it is enough.
This is of course offtopic for musl, given that there is no reasonable
standard/specification for the purpose.

Regards,
Rune

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.