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

Add vmstat to check context switches #596

Open
tailorzed opened this issue Jul 8, 2022 · 3 comments
Open

Add vmstat to check context switches #596

tailorzed opened this issue Jul 8, 2022 · 3 comments

Comments

@tailorzed
Copy link

tailorzed commented Jul 8, 2022

Could you please add vmstat -t to see the amount of context switches (with a timestamp)?

@cactusinthenorth
Copy link

@tailorzed Can you please add more detail to this ticket so it can be properly prioritized

@tailorzed
Copy link
Author

@cactusinthenorth: Sure, here we go:

Modern systems utilize multitasking which means that multiple processes/threads can share the same physical CPU (core). In order to implement this execution time on CPU is shared and limited to a certain time slot and when that ends, the state of the thread/process has to be saved to be resumed when the next available timeslot comes. The switching between processes/threads is called context switching. The downside of this technique is that if the system is running too many processes/threads, it takes a lot of resources to execute the context switching (also the timeslots are getting slimmer and slimmer). To determine if there is a lot of concurrent processes (meaning a lot of context switching) in the system, the vmstat command has an output field cs containing this number.

Example output:

# vmstat -t
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- -----timestamp-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st                 UTC
 1  0      0 21463564  35732 744408    0    0   501   452  295  452  1  2 97  0  0 2022-09-13 12:48:55

Manual page for vmstat: link

I hope this helps to support my request to add this printout.

@cactusinthenorth
Copy link

@cory-fair is this for you?

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

2 participants