Originally posted by oiaohm
View Post
Again, you don't know what you're talking about. If a thread goes to sleep, you need a fucking context switch. Threads don't "exist" on the CPU, so all the state needs to be saved and then switched to another thread anyway, you're not going to save anything in terms of overhead by avoiding the kernel context switch.
Originally posted by oiaohm
View Post
Your idea stinks of race conditions and is no different than just spinlocking for a fixed time and then syscalling in terms of overhead.
If you have to yield, a context switch is needed anyway, since your thread will have to be replaced by another thread.
Originally posted by oiaohm
View Post
Why should a thread that has to wait (due to mutex) block for its entire time slice when it could immediately yield and another thread would be able to do useful work during that time? ffs there's NO reason a thread has to finish its time slice, especially if it has to wait. It's wasted work and wasted energy.
You just don't get it that a spinlock wastes time because other threads wait until that thread's time slice is up. Waiting is lost performance which is worse than a context switch in many cases. It's only useful if you KNOW with a high probability that it will most likely become free very soon.
Furthermore we started the whole argument about ZERO SPINLOCKS. Because I already am WELL aware of designs with spinlocks. YOU claimed you can avoid syscall without spinlocks. YOU did. So the fact you resort to it when I CLEARLY said no spinlocks should be involved shows to me you're grasping at straws right now.
Comment