title: Program exceeding theoretical memory transfer rate
body: <p>I have a laptop with Intel Core 2 Duo 2.4GHz CPU and and 2x4Gb DDR3 modules 1066MHz.</p>
  
  <p>I expect that this this memory could operate at speed 1067 MiB/sec, and as long as there are two channels, maximum speed is <strong>2134 MiB/sec</strong> (in case OS memory dispatcher will allow).</p>
  
  <p>I made a tiny Java app to test that:</p>
  
  <pre><code>private static final int size = 256 * 1024 * 1024; // 256 Mb
  private static final byte[] storage = new byte[size];
  
  private static final int s = 1024; // 1Kb
  private static final int duration = 10; // 10sec
  
  public static void main(String[] args) {
      long start = System.currentTimeMillis();
      Random rnd = new Random();
      byte[] buf1 = new byte[s];
      rnd.nextBytes(buf1);
      long count = 0;
      while (System.currentTimeMillis() - start &lt; duration * 1000) {
          long begin = (long) (rnd.nextDouble() * (size - s));
          System.arraycopy(buf1, 0, storage, (int) begin, s);
          ++count;
      }
      double totalSeconds = (System.currentTimeMillis() - start) / 1000.0;
      double speed = count * s / totalSeconds / 1024 / 1024;
      System.out.println(count * s + " bytes transferred in " + totalSeconds + " secs (" + speed + " MiB/sec)");
  
      byte[] buf2 = new byte[s];
      count = 0;
      start = System.currentTimeMillis();
      while (System.currentTimeMillis() - start &lt; duration * 1000) {
          long begin = (long) (rnd.nextDouble() * (size - s));
          System.arraycopy(storage, (int) begin, buf2, 0, s);
          Arrays.fill(buf2, (byte) 0);
          ++count;
      }
      totalSeconds = (System.currentTimeMillis() - start) / 1000.0;
      speed = count * s / totalSeconds / 1024 / 1024;
      System.out.println(count * s + " bytes transferred in " + totalSeconds + " secs (" + speed + " MiB/sec)");
  }
  </code></pre>
  
  <p>I expected the result to be under 2134 MiB/sec however I have got the following:</p>
  
  <pre><code>17530212352 bytes transferred in 10.0 secs (1671.811328125 MiB/sec)
  31237926912 bytes transferred in 10.0 secs (2979.080859375 MiB/sec)
  </code></pre>
  
  <p>How is that possible that speed was almost 3 GiB/sec?</p>
  
  <p><img src="https://i.stack.imgur.com/mK9Wn.jpg" alt="DDR3 module photo"></p>