From: Terje W. <wie...@sa...> - 2004-04-10 13:22:07
|
I don't know how things are done at the moment, but as far as I can=20 notice, mp3 files are not cached to memory when played by mp3example=20 (correct me if I'm wrong). Anyway, I thought that other programs as well=20 could benefit from a disk cache, and I thought of the following scheme: - Create a ramdisk at the maximum size we can spare (is 16MB ok?) - Write a new fopen() function - This function will check if there is enough space in the ramdisk for th= e=20 file If there is, it is copied there, and a file descriptor is returned fo= r=20 the new file. If not, a file descriptor is simply returned for the original file. - Write a new fclose() that, if the file is on the ramdisk, deletes the=20 file Maybe this is totally useless, and that the kernel already has a much=20 better way of handling disk cache, but I do think this could help with th= e=20 access time for files, and used with the hdparm fix from Jonathan it coul= d=20 also help battery time. Just an idea =3D) Terje |