Skip to content

Conversation

@kouvel
Copy link
Contributor

@kouvel kouvel commented Jun 2, 2022

  • Removed usage of Sleep(1)
  • Modified the spin-waiting scheme beyond the Sleep(0) threshold to avoid potentially long sequences of ineffective Sleep(0)s
  • Retuned the threshold to reprioritize deprioritized spin-lock requests

Fixes #69206

…Sleep(1)`

- Removed usage of `Sleep(1)`
- Modified the spin-waiting scheme beyond the `Sleep(0)` threshold to avoid potentially long sequences of ineffective `Sleep(0)`s
- Retuned the threshold to reprioritize deprioritized spin-lock requests

Fixes #69206
@kouvel kouvel added this to the 7.0.0 milestone Jun 2, 2022
@kouvel kouvel requested review from janvorli and mangod9 June 2, 2022 18:10
@ghost ghost assigned kouvel Jun 2, 2022
@ghost
Copy link

ghost commented Jun 2, 2022

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Issue Details
  • Removed usage of Sleep(1)
  • Modified the spin-waiting scheme beyond the Sleep(0) threshold to avoid potentially long sequences of ineffective Sleep(0)s
  • Retuned the threshold to reprioritize deprioritized spin-lock requests

Fixes #69206

Author: kouvel
Assignees: -
Labels:

area-System.Threading

Milestone: 7.0.0

@kouvel
Copy link
Contributor Author

kouvel commented Jun 2, 2022

On the test case in the fixed issue, the output is mostly empty (no latency higher than 0.5 ms), with the occasional ~1 ms latency. There is some tradeoff in throughput when there is high contention on the spin-lock, in favor of avoiding very high latencies, with this change. It seems like a necessary and reasonable tradeoff, since the higher throughput in the baseline is mainly artificial due to the Sleep(1) removing many threads from the contention (and introducing high latency on those threads).

@kouvel kouvel requested a review from AntonLapounov June 9, 2022 12:46
@kouvel kouvel merged commit 5544d9b into dotnet:main Jul 7, 2022
@kouvel kouvel deleted the RwlsFix branch July 7, 2022 18:54
@ghost ghost locked as resolved and limited conversation to collaborators Aug 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There may be unexpectedly high delays in ReaderWriterLockSlim operations

2 participants