Someone should write a library that uses seccomp-bpf to intercept blocking syscalls and route them to a user-mode scheduler on Linux…
-
-
Replying to @pcwalton
I actually tested this with a proof of concept. Trapping with seccomp/SIGSYS adds only ~0.75µs of overhead to every syscall.
2 replies 2 retweets 13 likes -
Replying to @pcwalton
Seems hard to believe. How fast is your box? 750ns does not sound plausible for the round-trips needed.
2 replies 0 retweets 0 likes -
Replying to @RichFelker @pcwalton
It would only be for compatibility, similar to the Windows implementation, i.e. the performance shouldn't really matter all that much.
1 reply 0 retweets 0 likes -
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.
1 reply 0 retweets 0 likes -
BTW, Go still only inserts yield points in function preludes. You can still block indefinitely by simply having a long loop with no calls.
1 reply 0 retweets 0 likes -
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.
1 reply 0 retweets 0 likes -
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.
1 reply 0 retweets 0 likes -
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.
3 replies 0 retweets 0 likes
This would be a temporary implementation, just FWIW; if successful, proper kernel support could be added.
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.