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

tests: Add sleep order testing #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

codemac
Copy link
Contributor

@codemac codemac commented Sep 8, 2016

Small pull request!

This just sets some small numbers, and makes sure they are in the naive order we expect. Next step after this is probably to generate 1000 or so randomly, and make sure they all fire in order.

Apologize for the mutex, I'm a beginner at using guile with threads.

@codemac
Copy link
Contributor Author

codemac commented Sep 9, 2016

Do not merge this. Updated with the random sleeps, but now it fails as the "goal order" does not take into account when things were actually spawned, thus the drift between each of the 1000 spawns isn't taken into acct.

Trying to see if there's a way to test this without test hooks from the scheduler itself, which would be nasty. Ideally these are tight enough that there are races that the scheduler evens out appropriately for us, otherwise this wouldn't test much of anything.

@wingo
Copy link
Owner

wingo commented Sep 11, 2016

Neat! Regarding the mutex, it's fine; I even used set! somewhere else in the file which isn't right if there are multiple kernel threads running the fibers. Something to fix I guess. You could use atomic boxes I guess (recently added to Guile; see make-atomic-box, atomic-box-ref, and atomic-box-compare-and-swap! usage in the source tree).

I worked on a related area and fixed some bugs regarding wakeup order. You might want to pull again and test again.

Thanks for working on this stuff and apologies for stompling on your feet, I often work on this when I'm not checking the internet too much :) If you want to explicitly coordinate IRC might be a good mechanism, otherwise we can continue opportunistically :) BTW would you be OK assigning copyright to the FSF? I don't know if any of this will make it to Guile itself but it would be a good idea to settle the copyright question now to keep that option open.

@codemac
Copy link
Contributor Author

codemac commented Sep 11, 2016

I'm totally good assigning ©️ to FSF if that's what you want for the project. I'm pro-GPL/FSF so no battles there!

I'll check out the atomic-box stuff, could be neat to use and see how I can better parametrize the concept of a clock for testing sleep. Probably way too much though, I'll play around.

And don't worry about toe stepping! It's your project, I just really want more concurrency patterns in guile for several of my projects, so figured I should help.

@emixa-d emixa-d added enhancement needs-changes This PR isn't quite right yet. labels Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs-changes This PR isn't quite right yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants