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

erts: Add BIFs processes_first/0 and processes_next/1 #9129

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

Conversation

lucioleKi
Copy link
Contributor

This PR adds 2 BIFs to the erlang module.

processes_first/0 returns a process iterator that can be used to iterate through the process table.

process_next/1 takes in a process iterator and returns a 2-tuple, consisting of one process identifier and a new process iterator. If the process iterator runs out of processes in the process table, none will be returned.

By using these 2 BIFs instead of processes/0, one can avoid creating a potentially huge list of the pids for all existing processes, at the cost of less consistency guarantees. Process identifiers returned from consecutive calls of process_next/1 may not be a consistent snapshot of all elements existing in the table during any of the calls.

@lucioleKi lucioleKi added the team:VM Assigned to OTP team VM label Nov 29, 2024
@lucioleKi lucioleKi self-assigned this Nov 29, 2024
Copy link
Contributor

github-actions bot commented Nov 29, 2024

CT Test Results

    4 files     85 suites   1h 9m 39s ⏱️
1 698 tests 1 455 ✅ 243 💤 0 ❌
1 977 runs  1 682 ✅ 295 💤 0 ❌

Results for commit 0da4f15.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@lucioleKi lucioleKi force-pushed the isabell/erts/processes_iterator branch from 9b38bf1 to 72b2c22 Compare November 29, 2024 12:48
@lucioleKi lucioleKi added the testing currently being tested, tag is used by OTP internal CI label Nov 29, 2024
@lucioleKi lucioleKi force-pushed the isabell/erts/processes_iterator branch from 72b2c22 to 56cdff4 Compare December 2, 2024 09:23
This PR adds 2 BIFs to the `erlang` module.

`processes_first/0` returns a process iterator that can be used to
iterate through the process table.

`process_next/1` takes in a process iterator and returns a 2-tuple,
consisting of one process identifier and a new process iterator. If the
process iterator runs out of processes in the process table, `none`
will be returned.

By using these 2 BIFs instead of `processes/0`, one can avoid creating
a potentially huge list of the pids for all existing processes, at the
cost of less consistency guarantees. Process identifiers returned from
consecutive calls of `process_next/1` may not be a consistent snapshot
of all elements existing in the table during any of the calls.
@lucioleKi lucioleKi force-pushed the isabell/erts/processes_iterator branch from 56cdff4 to 0da4f15 Compare December 2, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant