4 ms·
Of interest: Google has recently resumed trying to upstream its SwitchTo API into Linux. This API is 10-20x faster way to schedule threads (real threads) from u
by jeffbee 6y ago
Of interest: Google has recently resumed trying to upstream its SwitchTo API into Linux. This API is 10-20x faster way to schedule threads (real threads) from userspace.
https://lkml.org/lkml/2020/7/22/1202 https://lkml.org/lkml/2020/7/22/1202
- sosodev 6y agoWoah, that's really interesting. I was wondering if something like this had ever been explored.
- Qerub 6y agoOh, yes. I've been looking forward to this since I saw https://www.youtube.com/watch?v=KXuZi9aeGTw https://www.youtube.com/watch?v=KXuZi9aeGTw (User-level threads....... with threads. - Paul Turner - Google) in 2013.
- new_realist 6y agoThe best solution is to standardize tooling around backtraces and switch in userspace. Kernel switchto() has its place, but only between processes. It’s much, much slower than a userspace function call.
- gpderetta 6y agoThe way it is implemented in on top of the futex machinery is very elegant. Unfortunately it still need to go through the kernel, so it is probably going to be orders of magnitude slower than pure userspace based task switching, especially after spectre.
- jeffbee 6y agoAnd yet it is an order of magnitude faster than using the kernel thread scheduler, and you get to keep working thread-locals, normal process ID behavior, etc. It's a compromise.
- matheusmoreira 6y agoGreat! I remember reading about this but I thought it'd never make it into the kernel. What blocked its inclusion last time?