LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-18-2007, 02:47 PM   #1
terp4life2001
LQ Newbie
 
Registered: Dec 2005
Posts: 26

Rep: Reputation: 15
Can anyone explain %iowait?


Hello everyone,

I don't fully understand the %iowait metric reported by sar or vmstat. In particular I'm confused if %iowait is CPU time that can be consumed by another process or not.

For example, if I have a single active CPU where 25% is in system and 75% is in iowait; does this mean that the CPU is completely busy or could a new process make use of the iowait time?

The definitions of iowait that I've found are:

"man sar"
Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.

"man vmstat"
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.

This last definition seems to indicate that although there is outstanding I/O it should be included in idle time. Is this also the case for > 2.5.41? I'm using a 2.6.21 kernel.

Thanks in advance!

//Rob
 
Old 04-18-2007, 03:12 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
IOWait is a sub-category of idle. It is the time processes spend non-runnable because they have an active I/O operation that they are waiting on.
 
Old 04-18-2007, 03:21 PM   #3
terp4life2001
LQ Newbie
 
Registered: Dec 2005
Posts: 26

Original Poster
Rep: Reputation: 15
Does that mean that the % of CPU available is calculated as %idle + %iowait?

Last edited by terp4life2001; 04-18-2007 at 03:22 PM.
 
Old 04-18-2007, 03:30 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,500

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Indeed.

For example, Solaris has dropped this kernel statistic as it was more misleading and confusing than helpful, especially on multi-Core/multi-thread CPUs.

Last edited by jlliagre; 04-18-2007 at 03:32 PM.
 
Old 04-18-2007, 03:53 PM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
Quote:
Originally Posted by terp4life2001
Does that mean that the % of CPU available is calculated as %idle + %iowait?
There are additional sub-categories of idle + other (like steal time if you are running a hypervisor), so it's easiest to use:

available CPU = 100 - (user+system+steal)
 
Old 04-19-2007, 12:23 PM   #6
terp4life2001
LQ Newbie
 
Registered: Dec 2005
Posts: 26

Original Poster
Rep: Reputation: 15
You're all awesome! Thank you!
 
Old 04-19-2007, 04:57 PM   #7
nwmotogeek
LQ Newbie
 
Registered: Apr 2007
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by macemoneta
IOWait is a sub-category of idle. It is the time processes spend non-runnable because they have an active I/O operation that they are waiting on.

If IOWait time is a sub-category of idle time then it is already calculated into the idle time. So wouldn't 100 - idle time give you total system utilization?
 
Old 04-19-2007, 05:05 PM   #8
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
Quote:
Originally Posted by nwmotogeek
If IOWait time is a sub-category of idle time then it is already calculated into the idle time. So wouldn't 100 - idle time give you total system utilization?
Unfortunately, the "idle" designation is applied to any idle time not otherwise bucketed. A better designation would be "Miscellaneous Idle Time".
 
Old 04-19-2007, 05:36 PM   #9
nwmotogeek
LQ Newbie
 
Registered: Apr 2007
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by macemoneta
There are additional sub-categories of idle + other (like steal time if you are running a hypervisor), so it's easiest to use:

available CPU = 100 - (user+system+steal)

So I have run tests with SAR and I have found that 100 - (user+system+steal+iowait) is the same as 100 - (idle)

Can the iowait time be recovered by other processes or is it unusable?
 
Old 04-19-2007, 06:00 PM   #10
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
Maybe this will clear it up... You have a bunch of processes, some running, and some not. If a processes is not running, it isn't using CPU.

The reason some are not running is that they are waiting for an I/O to complete (iowait), or in hardware interrupt processing (hi), or software interrupt processing (si), or they can't get the CPU because the hypervisor is running (stealing CPU) at the moment (st). The last reason, st, is different because it actually shrinks your available CPU for a brief interval.

Those are the currently defined reasons for not running on the CPU, and every other reason (voluntary wait, system call wait, file event wait, etc.) are dumped into the remaining bucket, idle.

Tomorrow, the kernel developers could decide to break out 20 more reasons to be idle. Seriously, this could happen (there's a new scheduler under consideration). So attempting to get available CPU by accumulating the subcategories of idle will be different on different *NIX platforms, kernel releases, measurement tool releases.

That's why a more stable way of getting it is "100-(user+system+steal)". It's independent of the reasons something isn't running, and just looks at what's missing from the total.

Last edited by macemoneta; 04-19-2007 at 06:02 PM.
 
Old 04-20-2007, 02:01 AM   #11
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,500

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Quote:
Originally Posted by nwmotogeek
Can the iowait time be recovered by other processes ?
Yes, the CPU is idle so is ready to serve a runnable process, provided there is one.

As I already wrote, this iowait metric is getting meaningless with modern CPU architectures (multi-core/multi-thread).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is iowait? mynameisjohnny Linux - Newbie 2 07-27-2010 05:23 AM
major iowait issue Linux_Kidd Linux - General 1 12-29-2006 09:18 AM
iowait problem with 2.4 kernel bytez Linux - Kernel 1 10-10-2006 10:42 AM
Rhe:iowait mastermatics Linux - Enterprise 2 08-26-2006 06:18 AM
Iowait ashley75 Linux - General 25 02-11-2006 11:41 PM


All times are GMT -5. The time now is 07:35 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration