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.
This is mostly proof-of-concept to make sure that I'm on the right track. The main idea is to create an empty resource (
Store
from ConcurrentSim) when condition is not met, followed by!take
. This information is saved inwaiters
field in register, and!tag
(and!untag
) checks whether relevant conditions are met after tag has been changed, and push the corresponding qbit (slot).Here are a few questions/problems that I wanted to address:
How expensive is it to make a query? Currently,
waiters
is a nested dictionary; the keys are tags, and the values are dictionaries mapping tuples of queries (functions) and their arguments to lists of Stores waiting on those queries. I wanted to minimize the number of queries made by only checking ones that are relevant to the tag that is being changed. Using a lock instead of a Store might be beneficial since only one lock would be needed per query, though I think this approach would require re-running the query.In the example protocol, saving the query along with its arguments feels a bit awkward. I wanted to implement something that could handle any queries, but I think since
prot
is not accessible intag!
, passing the arguments directly isn't possible. Implementing this waiter feature for specific tags (the ones in current protocols) might be easier. Do you think this is the right direction?As I'm relatively new to Julia, I realize my syntax may be incorrect or awkward. I expect to resolve most of these issues once I can run the code, but I'd appreciate any feedback on obvious mistakes or good practices I might be missing.
Thanks a lot for your help!