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.
@Raymond Chen You should tell your colleagues that they either stop jerking around with critical sections or start testing legacy software and games to make sure they still work after those changes.
And I was wondering why Saints Row IV (specifically sriv_legacy branch on Steam) which I never had problems playing on this machine has become unplayable (it keeps hanging at random intervals with Windows popping its [End Program] [Cancel] message) unless I set the process affinity to only 2 out of 12 cores.
Too bad we users don't have a clear way of knowing about and opting out of such changes.
And...
Well the situation has arguably changed quite a lot over the past 30 years. There is so many software now that you can’t plausibly test everything. This bug affects only older versions of classic GTA San Andreas (an edition that is not sold anymore ‒ thanks R*), which is still miraculously relevant only because it’s the only version the multiplayer mod is compatible with.
Wow, I got some reports of this bug from people on my SA-MP server and I would have never believed this was the cause!