[MS] Why is Windows still tinkering with critical sections? - devamazonaws.blogspot.com

Adrian aka Silent aka CookiePLMonster did a deep investigation into how a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2.

One reaction I saw to this was "Why is Windows still tinkering with critical sections? Surely there aren't any bugs in it after all these years."

While there may not be bugs in critical sections, there may still be performance issues. And since critical sections are so heavily used, small performance issues can add up to large ones.

We saw some time ago that many synchronization objects were made unfair to avoid lock convoys.

At around the same time, critical sections were optimized to reduce their memory footprint, particularly their cost to non-paged pool. Non-paged pool is an expensive resource since (as the name suggests) it cannot be paged out. On systems doing large-scale computing, even a small cost in non-paged pool is multiplied by a enormous number of critical sections, resulting in outsized non-paged pool pressure that creates performance and reliability problems.

More recently, changes were made to critical sections to try to detect and mitigate priority inversions, and (what is significant in 24H2) those mitigations were optimized further by moving more of the work into user mode and avoiding some cases that previously entailed kernel mode transitions.

The critical section may be an old dog, but it's still learning new tricks in order to keep pace with a computing environment that is bigger, faster, and more concurrent that it was three decades ago.


Post Updated on September 24, 2025 at 03:00PM
Thanks for reading
from devamazonaws.blogspot.com

Comments

Popular posts from this blog

[MS] Pulling a single item from a C++ parameter pack by its index, remarks - devamazonaws.blogspot.com

[MS] Boosting Azure DevOps Security with GHAS Code Scanning - devamazonaws.blogspot.com

[MS] Going beyond the empty set: Embracing the power of other empty things - devamazonaws.blogspot.com