Reputation: 1167
I need to write a can change at any time stream to the file for others reading elsewhere, but if the disk is modified too frequently, this will definitely damage the disk.
It's said that Temporary file will use memory as possible without actually write into disk.
But I've found it "seems" still writing into disk.
Who can answer my confusion?
Upvotes: 2
Views: 72
Reputation: 186668
Modern HDD / SDD has a buffer cache (with a typical size of several Megabytes) which has been specially designed for this very issue: caching hot spots, frequently read and modified data. It's much faster to read/write data using memory than HDD; SDD has another problem: limited number of writes and thus we should avoid too frequent writes. In case of power off, a capacitor (or HDD disks rotation) provides enough energy to safely write down all the data from cache back to HDD/SDD.
In case of Copy
hot spot data will (with a high probability) stay at cache.
Resume: please, don't re-invent the wheel, let hardware manufactors do their own work and solve the (very typical) issue for you.
Upvotes: 1