Someone should write a library that uses seccomp-bpf to intercept blocking syscalls and route them to a user-mode scheduler on Linux…
Seems hard to believe. How fast is your box? 750ns does not sound plausible for the round-trips needed.
-
-
2.8 GHz Core i7 MacBook Pro. It was in a VM though… Raw read() on /dev/zero was like 0.18µs and the signal handler added like 0.5µs.
-
I guess 180ns ≃ 500 cycles is achievable for syscalls without much work to do, and ~3x that might be plausible for round trips.
-
To be clear, this is an awful hack, and I don’t love M:N, but IMHO if you’re going to do it you should make it compatible with existing code
-
IMO it's more interesting for sandboxing N threads or even processes in one actual thread.
-
Sure, that’s what seccomp was designed for. My basic problem is “if people really want M:N, what’s the best way to provide it”.
- End of conversation
New conversation -
-
-
It would only be for compatibility, similar to the Windows implementation, i.e. the performance shouldn't really matter all that much.
-
It lets you use legacy code using blocking system calls without it blocking everything, but it wouldn't be the preferred way to do I/O.
-
BTW, Go still only inserts yield points in function preludes. You can still block indefinitely by simply having a long loop with no calls.
-
https://github.com/golang/go/issues/10958 … since it doesn't support any kind of async preempt to deal with tasks that aren't yielding on their own.
-
seccomp-bpf wouldn't know if read is going to be non-blocking since it's a setting on the file rather than a parameter to read/write though.
-
So doing it that way is going to hurt performance of proper idiomatic code too. Can't see a way to tag read/write calls for seccomp to see.
-
By how much though? You’d just restart the syscall in the signal handler and BPF would let it through by checking rip register.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.