December, 2005

  • The Old New Thing

    What one Windows XP feature am I most proud of?

    • 56 Comments

    Of all the things I did for Windows XP, if I had to choose the one feature that I'm most proud of, it's fixing Pinball so it doesn't consume 100% CPU.

    The program was originally written for Windows 95 and had a render loop that simply painted frames as fast as possible. In the checked build, you could tell the program to display the number of frames per second. They reserved room for two digits of FPS.

    When I got to looking at Pinball's CPU usage, I built the checked version and took a peek at the frame rate. Imagine my surprise when I saw that Pinball's frame rate on contemporary hardware was over one million frames per second.

    I added a limiter that capped the frame rate to 120 frames per second. This was enough to drop the CPU usage from 100% to 1%. Now you can play Pinball while waiting for your document to print without noticeably impacting printing speed.

  • The Old New Thing

    On the inability to support hardware that nobody makes any more

    • 67 Comments

    Windows Vista will not have support for really old DVD drives. (The information below was kindly provided to me by the optical storage driver team.)

    When PC DVD drives first came out in 1998, the drives themselves did not have support for region codes but instead relied on (and in fact the DVD specification required) the operating system to enforce region coding, with the further understanding that starting on January 1, 2000 all newly-manufactured drives would support region coding in hardware rather than relying on software enforcement. For the purpose of this discussion, I will call the two types of drives "old" (manufactured before 2000) and "new" (manufactured on or after January 1, 2000).

    It is that software enforcement that is going away. Turns out that the enforcement of region coding in software had its own problems:

    • It was impossible for third-parties to compile their own CDROM.SYS from the source code in the DDK because the region code enforcement code was not included in the DDK.
    • The region code enforcement code would sometimes mistake a new drive for an old one, resulting in customers unable to play DVDs. Even worse, the driver test team could not reproduce the problem reliably, and the problem went away entirely once a debugger was attached to the system.
    • The code to support the older drives is complex, and the drives that the optical storage team purchased prior to January 1, 2000 are dead or dying. Consequently, testing the code that provides support for old drives has become increasingly difficult, and when the last old drive finally gives up the ghost, testing will become impossible altogether.

    These were among the considerations which contributed to the decision to stop supporting these old drives.

    What does this mean for you? Almost certainly, the answer is "absolutely nothing".

    First, there is no change to the way data is read from DVD drives, so data discs will still work the same way as they do today. Second, all new DVD drives will continue to run as they did before; the only change is that the risk of mis-identification as an old drive has been removed. Only if you have an old drive will you notice anything different, namely that encrypted/regionalized DVD movies will no longer play. And since the average drive lifetime is only three years, the number of such old drives that are still working is vanishingly small. Not even the optical drive test team can manage to keep their old drives alive that long.

  • The Old New Thing

    Why did the Windows 95 CD have extra fun stuff?

    • 13 Comments

    Why did the Windows 95 CD have extra fun stuff, like the Good Times and Buddy Holly music videos, the Rob Roy trailer, and the cartoons by Bill Plympton? Because it was fun! Why does one have to justify having fun?

    In addition to the multimedia fun, there was also video game fun, with the addition of Pinball and the mercifully-forgotten hovercraft game Hover! (Some of us thought it was so awful, we secretly called it Hoover!)

    [While Raymond was on vacation, the autopilot stopped working due to a power outage. This entry has been backdated.]

  • The Old New Thing

    Derren Brown's tips on being a psychic

    • 17 Comments

    Magician and mentalist Derren Brown teaches us how we can all exercise our psychic powers, or at least use psychology to make people think we're psychic. The Video Clips page collects all the examples into one place for your viewing pleasure.

  • The Old New Thing

    Why does Windows setup lay down a new boot sector?

    • 77 Comments

    Why does Windows setup lay down a new boot sector? Because the alternative is worse.

    You would expect that after installing an operating system, the operating system should boot. If your boot sector is damaged, say because this is a brand new hard drive with no boot sector, or because it was infected with a boot sector virus, you expect the operating system's setup program to replace the boot sector with a good one. If it didn't, you'd have an operating system that didn't boot.

    Not the greatest introduction to a new operating system.

    I know some people are going to suggest, "Why doesn't the setup program ask before overwriting the boot sector?" But think about it. It's Christmas Day, you're installing Windows XP on your computer, you go through the setup process, and it asks you a question you can't answer. "Gosh, the computer says that I have a custom boot sector. It says that this could be for legitimate reasons, or it could be due to a virus. How the heck am I supposed to know the difference?" That's assuming they even read the dialog. A much more realistic scenario is, "Eek! The computer is asking me a scary question! How do I cancel out of this? I hate computers. They're so hard to use."

    Yes, this means that if you are an ultradweeb with a custom boot sector, you will lose it when you install Windows. But Windows isn't picking on you. It even destroys itself. If you take a Windows XP machine and install Windows 2000 onto it, the Windows 2000 setup program will lay down a new boot sector that knows how to boot Windows 2000 but doesn't know about Windows XP. You'll have to restore the Windows XP boot files to restore that functionality.

    [Update 9am: Even if Windows Setup did give you the option of "don't overwrite the boot sector" you still wouldn't like it. Windows Setup would get to the point where it lays down a new boot sector, and it says, "Ooh, an unrecognized boot sector, and the user said they want to leave it alone. Okay, I won't touch it. Now, how do I tell the foreign boot sector where I installed this operating system?" Since the authors of Windows Setup are not clairvoyant, they don't know what kind of boot sector you're going to have, so they won't know how to tell that foreign boot sector, "Please add 'Windows' to the list of known operating systems, and here is how you start it." The result: You just installed an operating system and have no way to run it.]

    Things are a little better starting with Windows XP Service Pack 2 and Windows Server 2003 Service Pack 1, though. Those and future versions of Windows setup check the version of the NTLDR file and will leave a newer version of the boot loader intact rather than overwriting it with an older version. Let's just hope that you're not installing because you need a fresh boot sector...

  • The Old New Thing

    Humanity's greatest invention, according to seventh grade students

    • 42 Comments

    When I read that Ecologist Magazine is co-sponsoring an essay contest on the topic What is Humanity's worst Invention?, it reminded me of a related essay exercise assigned to seventh-graders by a friend of mine. The students (typically thirteen years of age) were given the topic What is humanity's greatest invention or discovery? Here are some of the greatest inventions and discoveries of all time, according to these students:

    pencils airplanes vaccines refrigerators
    pets craftsman tools steam engines iPods
    alarm clocks laptops shoes transportation
    computers microbes medicine microphones
    tomatoes cars light bulbs batteries
    fire hair products toilets spear tips
    marrying a princess incandescent light

    Some sentences written in support of these claims:

    • The invention of the light bulb has literally shed light on the world.
    • The first car ever invented was the Mercedes around the early 1800s.
    • You might have to actually wash the plates (without electricity).
    • The car was first invented by Harrison Ford.
    • the one thing that makes nerds drool when they here [sic] it's [sic] name: videogames
    • We all know that IPODS have a great deal of greatness.
    • A light bulb comes with a switch to turn it off.
    • All they had to eat was tin biscuits.
    • What if someone discovers a machine to make you love forever? You couldn't have that without electricity!
    • The light bolb helps in menny dirfpeant ways.
    • This realy cool pen could wright and use the couckulater
    • Wagons can have horses pull them while riding in them.
    • It can be used for evel porpoises such as bombs.
    • Thomas Edison was a very smart, experimental man.
    • Cars make it possible for people to have space time.
    • Without electricity, housework would take all day!
    • The computer has easily beat out the dog in the man's best friend race these days.
    • The riders are throwing themselves off cliffs and hitting trees. These are happy people.
    • The catskane will be even more helpful in the furter.
    • Many school assignments would be close to impossible, or even cancelled if computers were never invented.
    • The airplane was invented by the Write brothers.
    • When the austronaughts go up into the bitch black space.
    • Without these things (electricicity) there wouldn't be a AC/DC or Led Zeppelin and that would be torture.
    • If you forgot to make your mom a birthday cake, you would need a light bulb to read the recipe
    • Back then the only domesticated animals were calvary, poultry and livestock.
    • Cars are good because they are the fastest way in and out for the C.I.A.
    • The tomato, I believe is a harmless fruit that has been around for hundreds of years.
    • When the cavemen were around they probably didn't stress good hygine, but they did likely emphasize beauty. Cavemen and women used bones from animals as hair rollers or ornaments and used animal fat for gel in their hair.
    • If you open your heart to a cat and love it forever, it will eventually love you back.

    That last one is my favorite. There's something poetic about it.

    Update 1pm: It should have gone without saying that these are hardly representative samples of the students' work but rather the most amusing ones.

  • The Old New Thing

    When hyperthreading is enabled, all the processors are virtual

    • 25 Comments

    A common problem when answering technical questions is that people sometimes ask a question that can't or shouldn't be answered because it is based upon a misunderstanding. What's particularly frustrating is when they insist that you answer their question as posed, even when you try to explain to them that their question is itself flawed.

    It's as if somebody asked you the question, "Do I have to use the remote control to lock my kangaroo?" You could answer the question literally ("No"), but the person asking the question would walk away with the wrong conclusion ("Wow, kangaroos are self-locking!"). Robert Flaming recalls a similar analogy I made with balsa wood and nails.

    Here's an example of a question that betrays misunderstanding.

    I just enabled hyperthreading on my dual-Xenon machine, and Task Manager now shows four processors instead of two. Which of them are the physical processors and which are the virtual ones?

    When you turn on hyperthreading, each individual physical processor acts as if it were two virtual processors. From Task Manager's point of view, the computer has four virtual processors. The two virtual processors associated with each physical processor are completely equivalent. It's not like one is physical and one is virtual. They are both virtual and compete equally for a share of the one physical CPU. When you set processor affinities, you set them to virtual processors.

    To find out which virtual processors are associated with the same physical processor, you can call the GetLogicalProcessorInformation function.

  • The Old New Thing

    Beware the Image File Execution Options key

    • 20 Comments

    Beware the Image File Execution Options key (more). Its power can be used for evil as well as for good.

    Its intended use is to force a program to run under a debugger regardless of how it is launched (and secondarily to alter how the system treats the program). It's handy if you need to debug a program "in the wild" rather than under the controlled environment of your favorite IDE. For example, you can use it if you want to debug how a program runs when it is launched by some other program you can't debug.

    Two things people often forget:

    • If you err in specifying the debugger, the program won't launch at all. For example, if you get the path to the debugger wrong or if you subsequently uninstall the debugger, you'll get ERROR_FILE_NOT_FOUND when you try to run the target program since the system can't find the debugger.
    • Remember to delete the entry for your program when you no longer need it. Otherwise you'll wonder why the debugger keeps launching for no apparent reason.

    Evil can be done with the Image File Execution Options key. Malware can install themselves as the "debugger" for a frequently-run program (such as Explorer) and thereby inject themselves into the execution sequence.

    Note that the ability to use the Image File Execution Options key for evil purposes is not a security hole. To modify the key in the first place requires administrator permissions. Consequently, anybody who can exploit this feature already owns your machine.

  • The Old New Thing

    You probably don't want to run programs directly off your USB memory drive

    • 42 Comments

    You probably wouldn't want to run Windows or applications directly off your USB memory drive, even if you could. The reason is that the solid-state memory used by these drives support only a limited number of write cycles per block. (Originally measured in the thousands, though I'm led to believe that it's gone up since then.) Most software assume that a disk's lifetime is essentially infinite and have no qualms about writing to a file multiple times. For example, your program might decide to group its data in chunks. To modify a byte of the file, you would load a chunk, modify the byte, then write the chunk out. You've "spent" a write cycle for an entire chunk of data even though you really might have been able to get away with updating a single sector. What's more, if that one byte gets modified three times in a row, you just paid for three writes when you could have gotten away with just one if you had just done a little more caching.

    Operating systems often update a file's metadata with high frequency. The last-modified time on a directory entry gets rewritten each time the file is updated. The free block bitmap is updated each time disk space is allocated or released. The page file gets updated constantly. A database application will update its database index very frequently. Even a simple application will probably update its history and settings files often. These "hot spots" are most likely to wear out first on a drive. Unfortunately, these hot spots also tend to coincide with nonrelocatable critical file system metadata; as a result, once the sector responsible for, say, the free cluster table goes bad, the drive is useless (in the absence of hardware sector remapping).

    I know some people who wrote a so-called "Flash File System" specifically designed for this class of devices. It spread the writes out across the disk so that it wore uniformly, avoiding the "hot spot" problem. The file system came out in the early 1990's and promptly died because the hardware hadn't yet caught up to the software. It was a solution ahead of its time.

    Note that my information about the number of write cycles of flash memory is pretty old. Can modern USB drives handle millions of writes before wearing out?

  • The Old New Thing

    Psychic debugging: Why your CPU usage is hovering at 50%

    • 24 Comments

    Sometimes psychic debugging consists merely of seeing the bigger picture.

    On one of our internal bug-reporting mailing lists, someone asked, "How come when I do XYZ, my CPU usage goes to 50%?"

    My psychic answer: "Because you have two processors."

    The response was genuine surprise and amazement. How did I know they had two processors? Simple: If they had only one processor, the CPU usage would be 100%. This seems unhelpful on its face, but it actually does help diagnose the problem, because now they can search the bug database for bugs in the XYZ feature tagged "100% CPU" to see if any of those apply to their situation. (And in this case, it turns out that one did.)

Page 1 of 4 (33 items) 1234