I'm doing some performance tests that include reading files from disk and want to make sure that each test takes place under similar conditions.
In particular, how can one clear the disk cache? (I want to make sure that the second test isn't faster than the first one, just because some files they both use are still in cache.) Right now I'm doing: $ cat some_file_the_size_of_RAM > /dev/null Does this indeed clear the cache? Is there a better way? Also, are there several level of file/disk caches or just one? As always, thanks for your advice!