Would it be a good idea for threads to indicate when they enter/exit critical sections, allowing the kernel to decide not to pre-empt them at this time?
I’m envisioning speed ups in concurrent algorithms that use locks…
Would it be a good idea for threads to indicate when they enter/exit critical sections, allowing the kernel to decide not to pre-empt them at this time?
I’m envisioning speed ups in concurrent algorithms that use locks…
Doing this would require doing a syscall which would likely take more time than you could save.
What if it was a library that is inlined? When the thread is created, a syscall registers an address. The functions to “signal” entering/exiting a critical section simply write to the registered address.
Alternatively, a byte could be reserved in every thread local memory for this purpose. This would eliminate the syscall and the address lookup.
Probably the best way would be to go ahead and implement it on a fork and benchmark it with/without. Then, you’ll have data that people can evaluate to see if doing a PR would make sense. Working code always trumps ideas.