November, 2008

  • The Old New Thing

    How did Spicy Hot V-8 vegetable juice get added to the complimentary beverages in Microsoft kitchens?


    Today is Election Day in the United States. Don't forget to vote. (Void where prohibited.) In honor of Election Day, I figured I'd tell a story about voting.

    One of the complimentary beverages available in Microsoft kitchens is Spicy Hot V-8. (Sure it's tasty, but watch out for the sodium content!)

    I remember well when Spicy Hot V-8 was added to the refrigerators. At the 1992 Company Meeting, Bill Gates and then-head of HR Mike Murray appeared on stage to read questions submitted by employees ahead of time. One of the questions was "Can we carry Spicy Hot V-8 in the kitchens?"

    Mike Murray decided to put the matter to a voice vote.

    The measure "passed" overwhelmingly.

    Spicy Hot V-8 appeared in the kitchens the next morning.

  • The Old New Thing

    Sensor development kits were flying off the shelves


    After the Sensor and Location Platform PDC presentation, people were stopping by the booth and grabbing sensor hardware and development kits like they were candy. Then again, to geeks, this stuff is candy.

    (And technically, they weren't flying off shelves. They were flying out of bins. Well, and technically they weren't flying either.)

    Other notes from the last day of the 2008 PDC:

    • PDC content honcho Mike Swanson announced that PDC 2008 sessions and keynotes are now up for download, and will be available indefinitely. Available in Silverlight for live streaming, or in iTunes format, WMV, high-quality WMV (this one includes video of the speakers), and Zune for offline viewing. In response, Nigel Parker created the PDC session firehose.
    • Sometimes, when you make the sign too big, nobody can see it. Someone came up to me asking where the Azure booth was. I pointed at the insanely huge banner. "Probably somewhere over there."
    • The reason why room 406A is on the third floor but you press 2 to get there: The room numbers at the convention center are numbered based on room clusters. The 100's in one cluster, the 400's are in another cluster, etc. The "4" in 406 doesn't mean fourth floor; it means fourth cluster. And why do you push 2 to get to the third floor? Because Level 1 is a split level which occupies two floors. Therefore, in the elevator, there are two buttons to get to Level 1, depending on whether you want the upper half or lower half. Cluster 4 is on Level 2, so the button for that is 3.
    • A video of carrots. If you had come to my PDC talk, you'd understand. (The carrot joke elicited a mild chuckle from the main room, but I'm told that in the overflow room it totally killed. I'm not sure what that says about people in the overflow room. It really wasn't that great a joke, people.)
    • At Ask the Experts, I started out at one of the Windows 7 tables, and we speculated as to what the most obscure technical question would be. One of my colleagues suggested that it would be a BitLocker question. And what would you know, the very first person to come to our table had a BitLocker question. Later in the evening, I moved to another Windows 7 table and posed the same question. At the second table, we figured that the most obscure technical question would be about the dispatcher spinlock. About fifteen minutes later, somebody stopped by with a question about the dispatcher spinlock. I decided to stop playing this game. It was too much like a Twilight Zone episode.
    • One attendee was shy about speaking English (not being a native speaker) and came up with a clever solution: The attendee walked up to our table, said, "I have some questions, can you read them?" and then opened a laptop computer where a Word document awaited with the four questions already typed up in a large font so everybody could read them. We answered the questions, and everybody seemed pleasantly surprised with how well this approach worked.
    • At the end of the conference the Channel 9 folks held a giveaway for their giant beanbags. Like anybody would be able to take a giant beanbag home on the airplane. (Second prize: Two beanbags!)
    • James Senior has the PDC by the numbers. I have trouble believing the number of bananas consumed, though. Twenty-five bananas in four days? Perhaps we should start calling James Monkey Boy.
  • The Old New Thing

    If there's already a bug, it's not surprising that there's a possibility for error


    It's great to think about all the things that can go wrong but you also have to think about the situations that could lead to those bad things. In particular, you have to recognize when you are trying to avoid a bug that is ultimately outside your component and which you can't fix anyway.

    For example, consider this multithreaded race condition:

    Why is InterlockedDecrement used in the implementation of IUnknown::Release? The only reason I can think of is for multithread safety. But that Release function doesn't look multithread safe—what if another thread was about to increment m_cRef? Does the AddRef refcount incrementer have a special interlocked check for zero to catch this case?

    What if another thread was about to increment m_cRef? In other words, what if another thread was about to call IUnknown::AddRef? In other words, you have two threads and an object with a refcount of one. One thread calls Release and the other thread calls AddRef. The concern is that the thread calling AddRef may execute after the thread that calls Release, thereby "rescuing" the reference count from zero back to one.

    But this scenario you're worried about is already a bug. Suppose the second thread runs just a smidgen slower than the scenario you described, calling AddRef after the Release returns instead of while it is executing. Well, now, that's obviously a bug in the caller, isn't it? It's using a pointer after destroying it.

    This happens a lot: You're worrying about not introducing a bug into a hypothetical situation that is already a bug. The answer to that is "Fix the original bug."

    In this specific situation of reference counting, a useful rule of thumb is "If you're worrying about the possibility of a reference count incrementing from zero to one, then you already have a bug somewhere else."

Page 4 of 4 (33 items) 1234