Write Caching vs. Safe Removal

G

Guest

At Device Manager>Disk Drives>[R-click on particular disk drive]>Policies
Tab, we can choose between Optimize-for-Quick-Removal or
Optimize-for-Performance. I would normally use the Safely Remove Hardware
Icon, so, on the on hand, I might as well take advantage of the Optimize for
Performance option. But suppose a drive NOT optimized for quick removal
inadvertantly becomes unplugged, or if there is a power blackout---what bad
things can happen? Can I be in danger of losing all the data on the drive?
And how much of performance improvement does the Optimize for Performance
option afford? Not clear on the disadvantages (possible consequences) of each
of the two options. I don't know what write caching is.

Many thanks for input...!
Janet
 
M

M.I.5¾

Janetb said:
At Device Manager>Disk Drives>[R-click on particular disk drive]>Policies
Tab, we can choose between Optimize-for-Quick-Removal or
Optimize-for-Performance. I would normally use the Safely Remove Hardware
Icon, so, on the on hand, I might as well take advantage of the Optimize
for
Performance option. But suppose a drive NOT optimized for quick removal
inadvertantly becomes unplugged, or if there is a power blackout---what
bad
things can happen? Can I be in danger of losing all the data on the drive?
And how much of performance improvement does the Optimize for Performance
option afford? Not clear on the disadvantages (possible consequences) of
each
of the two options. I don't know what write caching is.

Drive cacheing come is two flavours.

Write Back ('optimised for speed'): In this scheme, when you access a drive,
the contents of the block (or blocks) that you are reading is copied into a
faster memory system (usually RAM). This means that although the initial
read is limited by the drive's speed limitations, subsequent reads from the
same block are much faster. Most modern cacheing systems are able to 'que
up' the next block in anticipation of reading. When it becomes necessary to
perform a write to the drive, the write is instead written to the cached
image in RAM and flgged as 'modified'. It is not actually written back to
the drive until the processor is less busy (though there is usually (but not
always) a maximum holding time beyond which a 'cache flush' is performed.
The option should exist to force a cache flush (In Windows: the 'safely
remove hardware' icon in the system tray).

Write Through ('optimised for quick removal'): In this scheme the read
cacheing works exactly like the previous case. However, when a write is
performed, the write takes place directly to the drive medium avoiding the
cache. The cache is flagged as being 'dirty' so that any future read of the
cache must first perform a cache update (in many schemes, the write takes
place to both the disk and the cache, but this makes little practical
difference as far as the user is concerned).

It should be clear that the first option provides for the fastest
performance of the drive system ('optimised for speed'). However, the big
disadvantage is if the drive is removed (or if the system power fails)
before the cache flush takes place. In this instance, the data in the cache
is lost and the drive will simply hold the previous version of the file. A
more serious situation occurs if the drive is removed or the power fails
*while* the cache flush is actually taking place. The upshot of this
depends on at exactly what stage the write back had reached. The effect can
vary from a corrupted file to a corrupted disk.

The second option provides that once the write has taken place, the drive
has the up-to-date data on it and can thus be removed almost immediately
('optimised for quick removal').

Which option you chose for your removable media depends on how disciplined
you are at flushing the cache, and how likely you are to have a power cut at
the wrong moment. For most users, I would recommend the the 'optimised for
quick removal' option to avoid potential catastrophies (particularly users
who are not savvy enough to understand cacheing). But if you believe that
you have the necessary discipline; want the last ounce of speed and have a
reliable power supply (or a UPS) then go for 'optimised for speed'.

HTH.
 
D

dobey

Janetb said:
At Device Manager>Disk Drives>[R-click on particular disk drive]>Policies
Tab, we can choose between Optimize-for-Quick-Removal or
Optimize-for-Performance. I would normally use the Safely Remove Hardware
Icon, so, on the on hand, I might as well take advantage of the Optimize
for
Performance option. But suppose a drive NOT optimized for quick removal
inadvertantly becomes unplugged, or if there is a power blackout---what
bad
things can happen? Can I be in danger of losing all the data on the drive?
And how much of performance improvement does the Optimize for Performance
option afford? Not clear on the disadvantages (possible consequences) of
each
of the two options. I don't know what write caching is.

Many thanks for input...!
Janet

Quick removal just means you can unplug without having to use the safely
remove device icon.
More useful for flash drives or small drives.
I'm not sure but I expect this method copies each file from the disk then
verifies it. This is slower to transfer as it has to read from source, write
to destination, read from source, write to destination etc.

Performance means faster transfer rates.
Useful for external HDDs or large capacity storage when transferring large
amounts of data in one go.

Write caching is when a large chunk of data is stored in a cache, (not sure
if this is the HDD cache, or a cache created in RAM, or from the pagefile),
then written to the drive in one go. It is faster as it can use the maximum
bandwidth for the transfer, but if the transfer fails all data in the cache
will be lost.

If you unplug anything, using any method while data is being transferred,
(surprise, surprise!), the transfer will fail.

If you aren't in a rush, and have no reason to believe your storage device
won't fall of the desk and become unplugged, then no reason not to use
performance. I expect most gains would be seen by using larger storage
capacity such as external HDD enclosures. I haven't measured it myself, and
it does depend on the chipset of your PC etc. You could run a test yourself
by trying both methods and timing the transfer.

Of course the flip side of that is, if you aren't in a rush you may as well
use quick removal mode, as it doesn't really matter time wise if the
transfer takes longer, so you can just unplug the drive when you are ready
to leave.

If you are using performance mode and unplug the device while it is not
being used nothing bad will happen. I'm inclined to think MS goes overboard
on the warnings sometimes, but then I meet users who do lots of stupid
things then blame the OS/car/toaster for their ignorance.

It may be possible to damage a mechanical drive, (spinning disk type
devices), or mess up the file system if the device is powered by the USB
port, but I think it is extremely unlikely it will be damaged by being
unplugged during a transfer.

As a general guide for flash drives, wait about 10 seconds for the file
transfer window to disappear , maybe do a refresh of the drive to check the
files exist on the device. It should be safe to unplug, regardless of method
you have used.

For external HDDs wait for the file transfer window to disappear and check
to see that the "in use/activity" light on the external drive is off, then
it should be safe to unplug or switch off.
 
Z

Zilbandy

Not clear on the disadvantages (possible consequences) of each
of the two options. I don't know what write caching is.

With write caching turned on, data may not get immediately written to
the hard drive when you do a 'save' in some program. The data is kept
in a queue and written to the drive when the system is less busy.
Usually this won't cause any problems, but there is a chance of losing
data. For instance, you are working on a Word document and you have a
couple other things going on in the background. You save the Word
document and 2 seconds later, the power goes out, the computer shuts
off. With the write cache enabled, there is a possibility that the
saved data has not yet been written to the hard disk, thus, you lose
the data. With the write cache turned off, when you hit the save
button, the data is saved immediately. If the little bar that
indicates your filing being saved completes, the data is on the hard
drive.

On my desktop computers, I have write cache DISABLED. On my laptop, I
have it ENABLED. The reason has to do with the time it takes for my
laptop to go into 'hibernate (something my desktop doesn't need to
do). With the write cache off, it takes several minutes for the laptop
to hibernate. Why? I don't know. If the write cache is enabled, the
laptop hibernates in 15 seconds. I'm sure someone at Microsoft could
tell you why, but WinXP seems to need the write cache enabled if you
wish to hibernate in a short time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top