Forum OpenACS Q&A: Response to Userland vs kernel-space threading

Collapse
Posted by Petru Paler on

The kernel scheduler is "entered" anyway, no matter what kind of threading model you use, because it runs periodically (usually on the timer tick). User space thread switching is indeed faster, but only by a small margin: the context switch latency on Linux is very low, and even lower between clone()d processes (because they share the same address space, thus no TLB flush is needed). On the other hand, the user space stuff introduces complexity needed by turning all system calls to their non-blocking counterparts, then slows down because of the need to constantly poll() all file descriptors in use.

The KSE stuff does look quite interesting, but I'm not convinced whether all the added complexity will pay off in performance and scalability. In the mean time, Linux's simple and fast model works very well :)