Skip to content

Rename execution contexts + improve their docs #15936

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

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

Conversation

ysbaddaden
Copy link
Contributor

As discussed in RFC 2 and in light of #15871 for example, the execution contexts are much more about "how fibers run", either concurrently or in parallel or by themselves (the intent), and have little to do with "threads" that are only the technical mean to achieve parallelism.

A great example is that the isolated context doesn't have the word thread in its name, despite being the only context that guarantees the fiber will always run on the same thread (the fiber owns the thread until it terminates).

This PR renames:

  • SingleThreaded to Concurrent
  • MultiThreaded to Parallel

It also refines the documentation of the different types to also insist on the intent, what it means, and what are the actual guarantees given by each context.

# Concurrency is restricted to a single thread. Fibers in the same context
# will never run in parallel to each other but they may still run in parallel
# to fibers running in other contexts (i.e. in another thread).
# Fibers running in this context can only run concurrently and never in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Keep the wording of "the same context. This point out clearly that this refers to specific context instances. Fibers in different instances of Concurrent do run parallel to each other.

Suggested change
# Fibers running in this context can only run concurrently and never in
# Fibers running in the same context can only run concurrently and never in

Copy link
Contributor Author

@ysbaddaden ysbaddaden Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weirdly, using "same context" is more confusing to me (it seems to apply to all contexts outside of concurrent).

Maybe "this context instance" or "same context instance" maybe?

Hum, it's not that confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the same context instance" would be a bit more precise. But it's also quite a mouthful.

Co-authored-by: Johannes Müller <[email protected]>
Co-authored-by: sbsoftware <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

3 participants