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

Remove CAS from signal #54

Open
hq6 opened this issue May 16, 2018 · 0 comments
Open

Remove CAS from signal #54

hq6 opened this issue May 16, 2018 · 0 comments

Comments

@hq6
Copy link
Member

hq6 commented May 16, 2018

Ideally we would like signal to be a blind write, but currently this may induce spurious wakeups in schedulerMainLoop, which would cause the target core to attempt to run a non-existent thread.

One possibility for fixing this is to use some value (all-zeroes) for the function block (storage location for function and arguments of new threads) to indicate that the thread is non-runnable. Under this proposal, schedulerMainLoop will check whether the function block is entirely zeroes after returning from dispatch(). If it is not, then assume it is a spurious wakeup and call continue. Also, on thread exit, before clearing the occupiedAndCount, set the function block to all-zeroes to indicate that the ThreadContext is unoccupied.

This eliminates ThreadContext::UNOCCUPIED and the CAS in signal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant