3 ms·
Does it also imply that a non-blocking event loop in the userspace application is energy-inefficient? Likewise, given that some OSes APIs (syscalls) provide bo
by e3b0c 8y ago
Does it also imply that a non-blocking event loop in the userspace application is energy-inefficient?
Likewise, given that some OSes APIs (syscalls) provide both non-blocking and blocking modes, should we prefer the blocking ones concerning energy efficiency?
- jjuhl 8y agoYes. A blocking loop will allow the CPU to power down until an event arrives. A non-blocking/busy loop will continue to burn CPU cycles and the CPU will be busy and cannot reach lower power states.
- imtringued 8y agoThey are pretty much equivalent. The kernel will only schedule your program when an event happens. The difference is that by using a blocking syscall you will need more threads which indirectly decreases energy efficiency through increased context switching and RAM usage. If you only have a single thread then blocking or non-blocking is going to consume the same amount of energy.