Kernel threads do context switch at kernel level instead of process level.
I am planning to set up an httpserver in perl. I want to know if perl threads have same advantage as kernel threads from the perspective of context switch.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m reasonably convinced that if you’re trying to write a high performance server, Perl is NOT the way to go about it – threads or no threads (Perl threads suck by the way, but that is irrelevant).
Context switching is NOT why the kernel-mode stuff is “more efficient” – but because they don’t have system call overheads. Having said that, the benefits of these low level optimisations are very, very edge-case. If your application is so performance critical that it needs these optimisations, you can probably just throw more machines at it more cheaply (this is of course a management decision). Writing kernel code is error prone (i.e. mistakes crash or break the kernel) and difficult to maintain as it needs to be updated for each new kernel version.