cancel
Showing results for 
Search instead for 
Did you mean: 

vmstat

SOLVED
Go to solution
Maaz
Valued Contributor

vmstat

help me understand the 'us' and 'sy'
please correct me if I am wrong

in vmstat output, under the CPU column
'us' and 'sy'

man vmstat
us: Time spent running non-kernel code. (user time, including nice time)
sy: Time spent running kernel code. (system time)

i did a small test
# for i in `seq 1 300`; do oowriter; done
the value of 'us' increases

but when i did
# dd if=/dev/urandom of=dd.img bs=1K count=10000
the value of 'sy' increases


Question: whats the non-kernel code ?

My view/knowledge:
software/applications(e.g OpenOffice, gimp, email clients etc) and daemons(web/dhcp/dns/mail), databases(oracle.mysql etc) are non-kernel code ?


Question: what are the running kernel code ?

My view/knowledge:
if I save some text using OpenOffice, then OpenOffice instructs the kernel(Linux) to do the work then the 'sy' value will increase ? am i right ?

i.e if execute some apps/db/daemons then the time to load/execute thos software/apps/daemons will be reflected by the 'us'
and

if the software do some processing(calculation, and manipulation, creation and deletion of files, and saving in the file) then the vlaue will be reflected in 'sy' column ?

regards
4 REPLIES
Ivan Ferreira
Honored Contributor

Re: vmstat

>>> oftware/applications(e.g OpenOffice, gimp, email clients etc) and daemons(web/dhcp/dns/mail), databases(oracle.mysql etc) are non-kernel code

Yes.

>>> if I save some text using OpenOffice, then OpenOffice instructs the kernel(Linux) to do the work then the 'sy' value will increase ? am i right ?

Yes

The sy will be increased when the program ask to the kernel to do part of the job, normally, through a system call:

Swapping is a process that will use high sy time, because it has to deal with pages allocation/deallocation and device handling.

http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Maaz
Valued Contributor

Re: vmstat

thanks, for explaining and acknowledging ;-)
Regards
Maaz
Valued Contributor

Re: vmstat

one last question in this thread :)


how do I know the reason behind the high value of wa, i.e, is it because the high network I/O
or high disk I/O

I know the high value of 'bi' and 'bo'(disk I/O) is also the cause of high value of 'wa', but how do I know that if the high rate of network I/O is also involved in the high vlaues of 'wa'

Regard
Ivan Ferreira
Honored Contributor
Solution

Re: vmstat

It's difficult that network I/O will cause high wait times. In my experience, high wait times is always caused by disk I/O.

You should monitor your network traffic with iptraf, or maybe, install collectl (collect for linux). It's an excelent performance tool.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?