title: How the util of iostat is computed?
body: <pre><code>iostat -x -d 
  </code></pre>
  
  <p>can display many i/o statistic info. 
  For util of iostat, the explanation is : </p>
  
  <blockquote>
    <p>Percentage of CPU time during which I/O requests were issued to the device (band-width utilization for the device). Device saturation occurs when  this  value  is close to 100%</p>
  </blockquote>
  
  <p>I want to know how the util was computed? </p>
  
  <p>I make an experiment, (see following code), start 40 thread to randomly read 40 files. I suppose the disk util should be very high, but I am wrong, 
  the iostat is as follow, anyone can give why? THX</p>
  
  <pre><code>Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
  sdb1              0.01     0.44  0.24  0.57     3.44     8.14    14.34     0.00    2.28   0.66   0.05
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;pthread.h&gt;
  
  using namespace std;
  
  void* work(void* a)
  {
      int* id = (int*)a;
      string file = "sys.partition";
      char buf[100];
      sprintf(buf, "%d", *id);
      file.append(string(buf));
      ifstream in(file.c_str());
      in.seekg(0, ios_base::end);
      size_t len = in.tellg();
  
      cout &lt;&lt; "open file : " &lt;&lt; file &lt;&lt; " , " &lt;&lt; len &lt;&lt; endl;
      srand(time(NULL));
  
      while(true)
      {
          size_t pos = rand() % len;
          in.seekg(pos);
          //cout &lt;&lt; pos &lt;&lt; endl;
          in.read(buf, 10);
          system("sync");
      }
      in.close();
  }
  
  int main(int argc, char** argv)
  {
      static const int num = 40;
      pthread_t threads[num];
      for (int i = 0; i &lt; num; i++)       {
          pthread_create(&amp;threads[i], NULL, work, &amp;i);
      }
      for (int i = 0; i &lt; num; i++)       {
          pthread_join(threads[i], NULL);
      }
      return 0;
  }
  </code></pre>