GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow for work stealing when only holding read locks by marcphilipp · Pull Request #4012 · junit-team/junit-framework

Conversation

@marcphilipp

@marcphilipp marcphilipp commented Sep 19, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This allows tasks with only read locks to be stolen by threads that are
currently holding only read locks.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
marcphilipp added 3 commits September 19, 2024 12:49
@marcphilipp
Wait for deferred task before shutting down ForkJoinPool
ede4958
@marcphilipp
Add failing test case for work-stealing with compatible locks
7f90fe3
@marcphilipp
Allow work stealing when more locks can be acquired without deadlock
8109abb
This allows tasks with only read locks to be stolen by threads that are
currently holding only read locks. The new compatibility check would
also support write locks but `NodeTreeWalker` forces children of tasks
with write locks to be executed on the same thread and thus no work is
being stolen.
@marcphilipp marcphilipp self-assigned this Sep 19, 2024
@marcphilipp marcphilipp added this to the 5.10.4 milestone Sep 19, 2024
@marcphilipp marcphilipp mentioned this pull request Sep 19, 2024
Backport "Workstealing can lead to deadlocks" #3990
Closed
4 tasks done
@marcphilipp
marcphilipp requested a review from leonard84 September 19, 2024 11:00
@marcphilipp

marcphilipp commented Sep 19, 2024

Copy link
Copy Markdown
Member Author

Actually, I think we can get rid of the special types for the global locks now. I'll add that to this PR before merging.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@marcphilipp
marcphilipp marked this pull request as draft September 19, 2024 11:53
marcphilipp added 2 commits September 19, 2024 14:03
@marcphilipp
Remove special classes for global locks
9803fce
@marcphilipp
Only check first additional resource as both sets are sorted
16f7f4c
leonard84
leonard84 suggested changes Sep 19, 2024
View reviewed changes
Comment thread ...tform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...atform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...atform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...latform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...t/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...t/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...rm-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@marcphilipp
marcphilipp marked this pull request as ready for review September 19, 2024 12:36
@marcphilipp
marcphilipp requested a review from leonard84 September 19, 2024 12:58
@marcphilipp
Use List to avoid overhead of TreeSet
1fb9268
@marcphilipp
marcphilipp force-pushed the marc/lock-compatibility-checking branch from 9edf0e0 to 1fb9268 Compare September 19, 2024 12:59
@marcphilipp
Remove unused equals/hashCode methods
627babc
@marcphilipp marcphilipp modified the milestones: 5.10.4, 5.11.1 Sep 19, 2024
@marcphilipp
Make locks incompatible as soon as one of them requires exclusiveness
3698e1f
leonard84
leonard84 reviewed Sep 19, 2024
View reviewed changes
Comment thread ...tform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...atform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...atform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...t/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...t/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...t/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...rm-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

marcphilipp added 3 commits September 20, 2024 08:42
@marcphilipp
Remove unhelpful lock output from toString() methods
dc3135d
@marcphilipp
Add more/better test cases
5a88d21
@marcphilipp
Polish ResourceLockTests
f18f048
@marcphilipp
marcphilipp requested a review from leonard84 September 20, 2024 07:36
leonard84
leonard84 approved these changes Sep 20, 2024
View reviewed changes

@leonard84 leonard84 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks good. Only some test suggestions and style bikeshedding left.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...atform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...t/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...rm-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...rm-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...rm-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...rm-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

marcphilipp and others added 4 commits September 20, 2024 12:05
@marcphilipp
Add explanatory comment
ec11802
@marcphilipp @leonard84
Include tests for compatibility of global read lock with first read-w…
cd93fdb
…rite lock

Co-authored-by: Leonard Brünings <[email protected]>
@marcphilipp @leonard84
Improve parameter names after extracting method
ed03140
Co-authored-by: Leonard Brünings <[email protected]>
@marcphilipp
Simplify generating locks
b6309e3
marcphilipp and others added 4 commits September 20, 2024 12:13
@marcphilipp @leonard84
Improve test naming
395861f
Co-authored-by: Leonard Brünings <[email protected]>
@marcphilipp
Add reasons for incompatibility and improve assertion messages
c205e5e
@marcphilipp
Add test for deferring multiple times
7c654e4
@marcphilipp
Merge branch 'main' into marc/lock-compatibility-checking
3bce266
@marcphilipp marcphilipp changed the title Allow work stealing when more locks can be acquired without deadlock Allow for work stealing when only holding read locks Sep 20, 2024
@marcphilipp
marcphilipp merged commit ebbf134 into main Sep 21, 2024
@marcphilipp
marcphilipp deleted the marc/lock-compatibility-checking branch September 21, 2024 08:58
marcphilipp added a commit that referenced this pull request Sep 21, 2024
@marcphilipp @leonard84
Allow for work stealing when only holding read locks (#4012)
6529d8d
This allows tasks with only read locks to be stolen by threads that are
currently holding only read locks.

---------

Co-authored-by: Leonard Brünings <[email protected]>
marcphilipp added a commit that referenced this pull request Sep 23, 2024
@marcphilipp @leonard84
Allow for work stealing when only holding read locks (#4012)
26f7f83
This allows tasks with only read locks to be stolen by threads that are
currently holding only read locks.

---------

Co-authored-by: Leonard Brünings <[email protected]>
(cherry picked from commit ebbf134)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@leonard84 leonard84 leonard84 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@marcphilipp marcphilipp

Labels

None yet

Projects

None yet

Milestone

5.11.1

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@marcphilipp @leonard84
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.