Re: Is there a way to flush the file cache?




zentara@xxxxxxxxxxxxxx wrote:
On 28 Dec 2006 21:56:41 GMT, General Schvantzkoph
<schvantzkoph@xxxxxxxxx> wrote:

What I want to do is the following,

1) Create a file and write it to the disk.
2) Read that file off of the disk and then check it.

I'm trying to check the SATA interfaces so it's important that the file go
to and from the disks. The file cache interferes with this because if the
file is present in the cache the program will get the cached copy not the
copy that is on the disk. The sync() call forces the disk writes to happen
immediately which is half of the battle. The other half is to purge the
file cache so that all subsequent file reads come from the disk. Is there
a way to do this?

Dosn't the 'sync' command do this?

Maybe. In traditional Unix, sync is a REQUEST to the kernel to flush
data. That the data is actually written right then is almost always
reasonable to assume, but isn't something you'd put your life on the
line over.

--
Tony Lawrence
Unix/Linux/Mac OS X Resources
http://aplawrence.com

.



Relevant Pages

  • Re: DSK to NIB Instruction
    ... > the .dsk image internally and then feed it to the emulated controller. ... > I don't have any literature available on low-level disk operation. ... This obviously depends on the emulator. ... > for a sync byte, which will be aligned correctly, then the bytes after ...
    (comp.sys.apple2)
  • Re: XFS: how to NOT null files on fsck?
    ... > Now I know it takes a while before data may end up on disk and that it ... > My filesystems all use the Allocation unit size allowed. ... "sync" command is issued will be on disk when the command finishes. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Write Signal on Disk II Question
    ... The Disk][does ... This zero-skipping mechanism is why sync nibbles work: ... But if your sampling rate is not sufficiently ... faster than 250KHz or your loop has timing jitter, the reliability of ...
    (comp.sys.apple2)
  • Re: IO scheduler based IO controller V10
    ... short depending on the disk speed. ... other is to drain async requests completely before starting sync ones. ... so delay overloading then too. ... reader can generate as well as writer, but I figured what's good for the ...
    (Linux-Kernel)
  • Re: Floppy Disk Interfacing
    ... If you had a PLL, ... you usually have all the sync bits to help you align your clock ... But how would you align it with the disk rotation speed ... at the end of the header. ...
    (sci.electronics.design)