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

Report the number of threads in different states at any given time #9

Open
harendra-kumar opened this issue Aug 24, 2023 · 0 comments

Comments

@harendra-kumar
Copy link
Member

harendra-kumar commented Aug 24, 2023

In a concurrent program we want to drive the CPU utilization as high as possible and task latencies as low as possible. If there are tasks that are on the CPU for long time, they can cause latency issues. Usually Haskell threads yield on allocations, but if there are tight loops without allocation or FFI calls, threads can run for longer times.

To study latency behavior in concurrent programs we want to monitor the thread runqueue length. If all the threads are blocked for resources for long durations keeping runq empty and CPU idle, that may indicate an issue. If the runq is idle and busy in bursts that may indicate a problem.

To drive latencies lower, IO bound tasks that may run for short durations on CPU and then block for IO should be given priority compared to longer CPU bound tasks that could run while the IO bound tasks are blocked. But not sure if there is a simple way to achieve roughly something like this. Keeping the time slice lower is the only simple way. But we can at least measure if this is a problem.

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

No branches or pull requests

1 participant