User level vs Kernel level threads
User level threads only exist in your language runtime, they must be mapped somehow to your kernel threads.
There are several models used:
- Many-One (green threads)
- Many-Many (rare)
In the many-one model, these threads are managed by your language runtime. If any of these green threads invokes a syscall, the entire program is blocked, until the syscall returns.
This is because the kernel thread the entire program runs on is blocked.
That being said, green threads are cheap to create compared to kernel threads, they do not require your OS to allocate and track new stack + registers for them, the language runtime will use the stack and register allocated for the current thread of execution.