qrand
qrand copied to clipboard
Concurrent/Parallel caching
Is your feature request related to a problem? Please describe.
Currently, calls to the quantum backends are not made until the BitCache
does not hold enough bits to satisfy the next request.
Describe the solution you'd like
Calls should be made automatically once the BitCache
reaches a certain minimum amount of bits to have stored. Since the task of fetching new random bits from online quantum backends is I/O bound, these calls can be performed on a new thread (i.e. concurrent, non-blocking). This functionality can be implemented by means of the observer or state patters.
Additional context
When using a local quantum simulator the process will no longer be I/O bound, but CPU bound instead. Multiprocessing (i.e. parallelism) should be a better alternative in this case, so it can be useful to choose from one or the other depending on the type of backend being used at runtime.