News for hackers. Stuff that matters.
Re:Show HN: Minimal Fibers by manwe150 on Friday May 18, 2018 @11:39PM (#17106527)
ucontext modifies the signal mask, requiring a syscall. That’s very expensive (as shown by the boost benchmark above), and usually unnecessary. “emulate” is a rather negative sounding way to describe running effective the same code as ucontext does (which also happens to typically be the same as sigsetjmp) - it’s not like ucontext has some privledged permissions. It’s “just” a context switch.
Re:Show HN: Minimal Fibers by bgongfu on Saturday May 19, 2018 @01:08AM (#17106742)
I was under the impression that Boost Context is more than that; at least that's what the amount of assembler code tells me; but I'll be the first to admit I don't have much patience for deciphering modern C++. I get that it's possible to invoke the same functionality as ucontext minus signal masks manually, but I'm not convinced it would save enough cycles to pay for the added complexity.
Re:Show HN: Minimal Fibers by gpderetta on Saturday May 19, 2018 @10:21AM (#17107992)
Saving the signal mask easily cost hundreds to thousand cycles. One or two order of magnitude more than the rest of contex switching.
Re:Show HN: Minimal Fibers by bgongfu on Saturday May 19, 2018 @04:03PM (#17109480)
For the record: I just benchmarked GnuPth with NULL sigmask against ucontext for the example in the post and it's slightly (3.4/3.2s) slower.