I have 6 threads. One of the thread get in some scope and turn on the 'lock' and all the other threads are waiting and want to enter to the same scope.
Now, Is the other threads will get CPU Time? Does the other thread are in the thread schedule ? I understand that all the other thread are in waiting state - but the CPU will try to make the thread continue and try to get in the scope ( even if the scope is not accessible )
When trying to enter a lock that's already taken, threads first spinlock for a while, and finally suspend and enter a wait state.
They still burn CPU time while they spin, but no longer once they wait.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With