I have problems to understand the file cache algorithms.
The following behaviour is observed with kernel 2.2.15pre5 + ide20000127
patch.
My Computer has 256 MB RAM and initially a big part of them is free.
If i generate a big file, most of the free memory is used for the page
cache, as expected:
% dd if=/dev/zero of=xtmp bs=1000000 count=300
% free
total used free shared buffers
cached
Mem: 258248 255208 3040 6608 188100
11016
-/+ buffers/cache: 56092 202156
If i remove this file, the file file cache is further used:
% rm xtmp
% free
total used free shared buffers
cached
Mem: 258248 255156 3092 6968 188008
11040
-/+ buffers/cache: 56108 202140
But what is in the file cache? There is no corresponding file system
data for the file cache, because 'xtmp' vanished.
My other problem:
Now if i *read* the same file instead of removing the file like above,
the file
cache is not longer used after the unlink command:
% dd if=/dev/zero of=xtmp bs=1000000 count=300
% free
Mem: 258248 255252 2996 5892 195252
4956
-/+ buffers/cache: 55044 203204
% wc xtmp
% free
total used free shared buffers
cached
Mem: 258248 255540 2708 4852 5244
216700
-/+ buffers/cache: 33596 224652
% rm xtmp
% free
total used free shared buffers
cached
Mem: 258248 44304 213944 4864 5272
5448
-/+ buffers/cache: 33584 224664
It seems to me that the file cache ...
- is used longer than the live time of a file, if the corresponding file
is *written* but
- vanishes if the file is *read* and then deleted.
I won't say that this is an error in the cache code, i don't know it!
But i simply don't understand whats happen. Could someone explain?
The described behaviour seems to me a little inconsistent, out of the
view
of a simple user.
Bernd Melchers
-- melchers@fu-berlin.de Freie Universitaet Berlin- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:15 EST