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

Add exclusiveWith for transactions #12

Open
amascare opened this issue Feb 12, 2024 · 4 comments
Open

Add exclusiveWith for transactions #12

amascare opened this issue Feb 12, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@amascare
Copy link
Collaborator

It would be great to be able to have mutually exclusive transactions like done for the applications. This would allow us to work at a lower level of granularity, which helps to be more precise in some cases.
For example, t_a exclusiveWith t_b.

@amascare amascare added the enhancement New feature or request label Feb 12, 2024
@Gaudeval
Copy link
Collaborator

Gaudeval commented Apr 12, 2024

It can be done.

Understand that exclusiveWith is an interference view operator, so it can only be used during interference rules specification for transactions (respectively applications) in the definition of a PhysicalTableBasedInterferenceSpecification (respectively ApplicativeTableBasedInterferenceSpecification).

We consider the former case, specifying interference for transactions. The process is the following:

  1. Specify interference rules on transactions: We declare a trait that extends PhysicalTableBasedInterferenceSpecification.
  2. Configure the platform to view transactions: We specify the platform to which the specification applies (standard in PML), and configure the platform with a software and a transaction library (not as standard here).
  3. Tag two transactions as exclusive: We tag each transaction as used and retrieve its concrete counterpart. Then we can call the exclusiveWith operator on both concrete transactions.
  4. Repeat 3. as required
/* 1. Specify interference rules on transactions */
trait MyPhysicalTableBasedInterferenceSpecification extends PhysicalTableBasedInterferenceSpecification {
  /* 2. Configure the platform to view transactions. */
  self: SimpleKeystonePlatform with SimpleSoftwareAllocation with SimpleKeystoneTransactionLibrary =>
  /* ... */

  /* 3. Tag two transactions as exclusive */
  for {
    /* Tag each transaction as used, and retrieve its counterpart */
    l <- t12_app1_rd_d1.used.toPhysical 
    r <- t221_app22_rd_d2.used.toPhysical
  } yield {
      l exclusiveWith r /* Tag the selected transactions as exclusive */
  }

@kevin-delmas , I am conscious this is quite an inelegant workaround. I might ping you to discuss how to add an operator on Transaction that does just this.

@kevin-delmas
Copy link
Collaborator

The workaround of @Gaudeval is indeed a solution.
We do not consider exclusive operator on User Transactions.
@amascare Would you like to directly tag User Transactions as exclusive that is

 t12_app1_rd_d1 exclusiveWith t221_app22_rd_d2

If so, this may request an additional development to be scheduled.

@amascare
Copy link
Collaborator Author

Thank you @Gaudeval and @kevin-delmas.
I think it would be a good idea to have it in the future for the sake of simplicity, especially in complex systems. However, I would say that is not a priority as the workaround provided by @Gaudeval is functional.

@kevin-delmas kevin-delmas self-assigned this Dec 12, 2024
@kevin-delmas
Copy link
Collaborator

Ok then, we add that to the scheduled enhancements.
I will see if such simple improvements could be achieved by @ccoquand (with my full support for sure 😉 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants