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

Draft: threads scheduler #4047

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

jclab-joseph
Copy link

@jclab-joseph jclab-joseph commented Dec 18, 2023

  • amd64/linux createThread
  • amd64/windows createThread
  • 386/linux createThread
  • arm/linux createThread
  • arm64/linux createThread
  • arm64/linux createThread
  • testdata
  • Leave possible pause to the OS.

#2290 must be merged first.

This is a draft of a threads scheduler implementation as a cornerstone of a multi-core implementation.

I can't do it alone. I would love to work together.

See #2446

niaow and others added 2 commits December 18, 2023 10:12
This changes task.Stack and task.Queue to use atomic compare-and-swap operations.
With this change, they can also be executed safely from multiple threads/cores.
Additionally, the queue is actually LIFO now (not sure what I was thinking before).
@dgryski
Copy link
Member

dgryski commented Dec 21, 2023

In addition to the scheduler, the sync/* packages probably needs to be rewritten to account for concurrency.

@jclab-joseph
Copy link
Author

Yes,
Need to test it further, but once #2290 is merged, Mutex, Cond, etc. will likely be thread safe.

@aykevl
Copy link
Member

aykevl commented Feb 25, 2024

Another important piece is the garbage collector. You need to find a way to pause all other threads while the GC is running.

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

Successfully merging this pull request may close these issues.

None yet

4 participants