Friday, July 15, 2005

There's a story from the French school system that a roommate long ago regaled me with:

The smartest kids study math. The kids who aren't smart enough to study math study physics.

Extrapolate further...

(though in fairness many of the smartest kids do go to MS...)

The apocryphal history of file system tunnelling: "


One of the file system features you may find yourself
surprised by is tunneling,
wherein the creation timestamp and short/long names of a file
are taken from a file that existed in the directory previously.
In other words,
if you delete some file 'File with long name.txt'
and then create a new file with the same name,
that new file will have the same short name and the same
creation time as the original file.
You can

read this KB article
for details on what operations are
sensitive to tunnelling.


Why does tunneling exist at all?


When you use a program to edit an existing file, then save it,
you expect the original creation timestamp
to be preserved, since you're editing a file, not creating a new one.
But internally, many programs save a file by performing a
combination of save, delete, and rename operations
(such as the ones listed in the linked article),
and without tunneling, the creation time of the file
would seem to change even though from the end user's point of view,
no file got created.


As another example of the importance of tunneling,
consider that file 'File with long name.txt',
whose short name is say 'FILEWI~1.TXT'.
You load this file into a program
that is not long-filename-aware and save it.
It deletes the old 'FILEWI~1.TXT'
and creates a new one with the same name.
Without tunnelling,
the associated long name of the file would be lost.
Instead of a friendly long name,
the file name got corrupted into this thing with squiggly marks.
Not good.


But where did the name 'tunneling' come from?


From quantum mechanics.


Consider the following analogy:
You have two holes in the ground, and a particle is in the
first hole (A) and doesn't have enough energy to get out.
It only has enough energy to get as high as the dotted line.

A B


You get distracted for a little while,
maybe watch
the Super Bowl
halftime show,
and when you come back, the particle somehow is now
in hole B.
This is impossible in classical mechanics, but
thanks to the wacky world of quantum mechanics,
it is not only possible, but actually happens.
The phenomenon is known as

tunneling
,
because it's as if the particle 'dug a tunnel'
between the two holes, thereby allowing it to get from one hole
to another without ever going above the dotted line.


In the case of file system tunneling,
it is information that appears to violate the laws of classical
mechanics.
The information was destroyed (by deleting or renaming the file),
yet somehow managed to reconstruct
itself on the other side of a temporal barrier.


The developer who was responsible for implementing tunneling
on Windows 95 got kind of carried away with the quantum
mechanics analogy:
The fragments of information about recently-deleted or recently-renamed
files are kept in data structures called 'quarks'.
"



(Via The Old New Thing.)

No comments: