Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROPOSAL] Binding a method to a separate thread #87

Closed
sh-ad opened this issue May 16, 2021 · 6 comments
Closed

[PROPOSAL] Binding a method to a separate thread #87

sh-ad opened this issue May 16, 2021 · 6 comments

Comments

@sh-ad
Copy link

sh-ad commented May 16, 2021

Scanning operations are common in concurrent data structures. Scanning operations are operations that, in the course of their execution, go through all the elements. For example, for a Set, this would be "isEpmty".
For testing, the most interesting option seems to be when such operations will be performed in a separate thread. This will increase the number of cases when several operations are performed on one element at once.

Now:

Execution scenario (init part):
[add(6), remove(1), remove(4), isEmpty(), add(0)]
Execution scenario (parallel part):
| remove(-10) | isEmpty()   | remove(4)  | isEmpty() |
| add(-9)     | isEmpty()   | add(-7)    | remove(7) |
| isEmpty()   | remove(-8)  | remove(6)  | isEmpty()|

Proposal:

Execution scenario (init part):
[add(6), remove(1), remove(4), isEmpty(), add(0)]
Execution scenario (parallel part):
| isEmpty() | remove(-10)| remove(4)| add(8)    |
| isEmpty() | isEmpty()  | add(8)   | add(1)    |
| isEmpty() | remove(-8) | remove(6)| remove(-4)|
@alefedor
Copy link
Contributor

@sh-ad
Hi!
Technically, you can write your own ScenarioGenerator, but I agree that it is not an easy and enjoyable code.
Instead of just binding a thread we probably want a more general scenario specification.
Do you have any ideas on how the scenario should be configured?
For example, we can try to add a type-safe builder for Kotlin that looks like

options.scenario {
  thread {
    actorsPerThread(3)
    operations(TestSet::isEmpty)
  }
  repeat(3) { 
    thread() // just a default thread
  }
}

@sh-ad
Copy link
Author

sh-ad commented May 22, 2021

@alefedor
Thank you, I wrote my own generator that solves the problem.

Did I get the idea right, to make it possible to configure each individual thread through the builder?

@alefedor
Copy link
Contributor

@sh-ad
Yes, you are right. The idea is to choose the types and the number of operations in each thread

@sh-ad
Copy link
Author

sh-ad commented May 22, 2021

@alefedor
I will try to implement this idea.

Is the implementation details better discussed here or elsewhere?

@alefedor
Copy link
Contributor

@sh-ad
That's great that you want to implement this. Thank you!

Is the implementation details better discussed here or elsewhere?

How about telegram?
Telegram: @Alehard

@sh-ad
Copy link
Author

sh-ad commented May 22, 2021

Summary:

  • It seems interesting to add functionality that would allow you to configure scenario generation in more detail, right down to the level of operations.
  • Create a separate issue with a description of this
  • Collect usage cases there

#90

@sh-ad sh-ad closed this as completed May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants