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

get_queue_length and get_thread_count not well documented #3725

Closed
biddisco opened this issue Mar 2, 2019 · 4 comments
Closed

get_queue_length and get_thread_count not well documented #3725

biddisco opened this issue Mar 2, 2019 · 4 comments

Comments

@biddisco
Copy link
Contributor

biddisco commented Mar 2, 2019

During my cleanup of scheduling code (shared_priority_scheduler) I have been worried by the uses of
get_queue_length and get_thread_count as they are not well documented and it is not completely clear what the difference between the 2 should be (c.f. #1868 ) and when one or the other should be used.

My understanding is that get_queue_length simply reports the number of tasks in the pending/staged queues (regardless of state/priority), whereas get_thread_count (which accepts state/priority flags) does a more specific query and can include suspended threads that are not in the queues (and must be found from the thread_map).

I would like a clear definition of what these functions should count so that I can a) improve the documentation, and b) ensure that the code changes I am making are counting the right things.

@biddisco
Copy link
Contributor Author

biddisco commented Mar 2, 2019

I will try to make this easier to respond to be asking specifically whether my interpretation is correct

get_queue_length(priority) should return the number of staged+pending tasks in a given queue. When priority is requested, this should be either high/low/normal and return the length of the appropriate queues. If priority is unknown or undefined, then the sum of all high/low/normal queues should be returned.
When called on the scheduler::get_queue_length(id, priority), it should return the number for the queue/thread id requested. if the id is -1 then it returns the total for all queues/threads.

get_thread_count(state, priority) returns terminated_items_count for the terminated state and for staged/pending counts it returns the subset of get_queue_length() above (which is the sum of both staged and pending). For the suspended state, it must traverse the thread map and count them. If state is unknown then we return the total of map - staged - terminated - which gives essentially the ones that are ??? - what should it return?

@hkaiser
Copy link
Member

hkaiser commented Mar 2, 2019

@biddisco your interpretation sounds about right. Thanks for this clarification.

@msimberg msimberg removed this from the 1.3.0 milestone Apr 24, 2019
@stale
Copy link

stale bot commented Oct 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the tag: wontfix label Oct 21, 2019
@stale
Copy link

stale bot commented Nov 20, 2019

This issue has been automatically closed. Please re-open if necessary.

@stale stale bot closed this as completed Nov 20, 2019
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

3 participants