User level threads – with threads
youtube.com
youtube.com
This describes work being done by Google on the Linux Kernel scheduler that adds a couple new syscalls that, when taken together, allow cooperative multithreading of kernel threads from user-space. Basically, they let user-mode libraries bypass the kernel scheduler and explicitly yield to another thread or process.
This work is important because:
It brings Erlang-style processes or Go-style goroutines to C/C++, and by extension, any scripting language built on the UNIX/C infrastructure. Instead of needing your whole language to be aware of concurrency, you can use the standard C stack for concurrent processes, and switch between them in user-space without the full overhead of a context switch. Moreover, this cooperative scheduling is aware of kernel-level blocking, so you don't need to worry about a wayward blocking call wedging the whole machine.
It lets interpreters with a GIL - notably Python and V8 - use process-based concurrency while still enjoying the efficiency of event-based concurrency models.
It enables fast RPCs between same-server processes, even when the processes are written in different languages. Combined with a serialization format like Cap'n Proto, where all languages share the same memory layout, you can get zero-copy IPC between languages with a cost not much more than a standard method call.
It introduces some of the ideas of exokernels - namely, that the kernel's job is just to securely multiplex the hardware, and policy decisions should be made in user-space - to the modern Linux kernel.