Hacker News new | ask | show | jobs
by q3k 3063 days ago
Correct. If a process is waiting on a recv()/send() (or any other non-asynchronous IO syscall on Linux), the userspace process will go into (un)interruptible sleep and another process can be scheduled in it's place. When data is ready to process (or a signal needs to be delivered) the original process will be scheduled again and the syscall will return. It would be absurd for the CPU to busy wait on data.

And if the language you're choosing is a slow interpreted language like PHP then I'm fairly sure the context switch overhead is negligible.