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

Inject custom clocks, RNG's #15

Open
mcandre opened this issue Dec 23, 2018 · 2 comments
Open

Inject custom clocks, RNG's #15

mcandre opened this issue Dec 23, 2018 · 2 comments

Comments

@mcandre
Copy link

mcandre commented Dec 23, 2018

I saw the awesome talk on CloudABI and think it would be a good idea to begin offering dependency injection for the system clock and for random number generation, for even richer application tests. Could we begin designing an API towards that end?

@EdSchouten
Copy link
Member

Couple of things we need to take into consideration when designing such APIs:

  • Making PRNGs injectable shouldn't be too hard. We could simply model PRNGs as pipes from which you can read data. There is no need to add any special kernel primitives for that. We do need to keep in mind that PRNGs are already used at a very early stage, namely to set up stack smashing protection (SSP). The random seed is currently passed in through the auxiliary vector (AT_CANARY + AT_CANARYLEN). Do we want to keep AT_CANARY? If so, should it be seeded by the PRNG? Or should we change crt0 to read from the PRNG on process startup?
  • Injecting clocks is an interesting one. It's not just that a clock is read, processes may also sleep on them. And in the case of polling frameworks, sleep may be interrupted. What would the API look like from an implementation side? Do we want the implementation to get insight in the full list of threads that are waiting, or should it only communicate information about the first thread that needs to be woken up?

@mcandre
Copy link
Author

mcandre commented Mar 2, 2019

yes

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