failing like never before

25Jan/103

Intel FDIV Bug

A few years or so back, I put up a bunch of my high school and early college papers on this blog (they're under the "literature" category). Its a sad state of affairs when looking back my high school papers, that I realized my writing skills were significantly better back in high school. But anyways, heres a paper I wrote for my engineering ethics course. Its not my best work, and it certainly lacks the finish of my old high school stuff, but its passable.

To the Intel Corp. Board of Directors: A Post Mortem Report of the Pentium Flaw
Abstract

The floating point division flaw in the original Intel Pentium CPU, which resulted in some floating point division operations being calculated improperly, was a result of a few poor engineering decisions and while avoidable, was not condemnable. The subsequent decisions made by Intel executives, to keep the flaw hidden and then to downplay its importance, were however, morally flawed. While Intel executives adhered to a utilitarian ethical framework, they forgot to consider the impact their decisions would have on Intel’s public image. Had Intel executives followed a combination of rights and utilitarian ethics, where the rights of the customer are upheld while the company’s wellbeing is still valued, executives would have reached the correct decision, which was to offer a full “no questions asked” replacement policy at the very first discovery of the flaw.

The Pentium “FDIV Bug”

Given certain types of input data, the floating point division instructions on the original Intel Pentium CPU would generate slightly erroneous results. This result was dubbed by the public as the “FDIV Bug,” as one of the assembly language instructions affected by the bug was the FDIV instruction. Although Intel initially attempted to keep information regarding the flaw hidden, it eventually became public knowledge. The subsequent actions of Intel executives regarding their handling of the flaw were morally questionable and ultimately resulted in great damage being done to Intel’s public image. A different set of ethical frameworks would have allowed Intel executives to have reached the correct decision.
Using the basic Microsoft Windows calculator, a Pentium user could check for the presence of the flaw by performing the following calculation:

(4195835 * 3145727) / 3145727

The expected result of dividing a number by itself is one, so the equation above should yield a result of 4,195,835 but the flawed Pentium Floating Point Unit (FPU) produced a value of 4,195,579; an error of 0.006%. Not all calculations performed by the FDIV instruction on a Pentium CPU were incorrect however. The occurrence and degree of inaccuracy of the floating point division calculations were highly dependent on the input data and specific divide instruction used, and in most cases, the flaw was not apparent at all. According to Intel Corp., the flaw would only be encountered once every 27,000 years under normal use, although other groups have produced significantly different failure rates.
The “FDIV Bug” did not affect Intel CPUs predating the Pentium, as the flaw was a defect in a new algorithm that was intended to provide improved floating point performance over the Intel 486 (the predecessor to the Pentium). The Pentium used a new radix 4 SRT algorithm (named after its creators Sweeney, Robertson, and Tocher) in its floating point division operations, which required the use of a lookup table to improve calculation speed (Intel Corp. Section 4). This lookup table was generated prior to assembly and then loaded into a hardware Programmable Lookup Array (PLA) on the Pentium chip. However, the script which downloaded the lookup table into the PLAs had a bug in it that caused some lookup table entries to be omitted from the PLAs. Consequently, floating point division instructions that required the missing entries from the lookup table would produce erroneous values. This flaw has since been fixed and the “FDIV Bug” is no longer apparent in newer Intel CPUs.

The Pentium flaw should have been easily discoverable in early testing of the CPU, but there was also a mistake in Intel’s proofs for the Pentium FPU. Intel engineers attempted to simplify testing, and assumed that the sign (“+” or “-“) of a number doesn’t enter into division operations except in the last step. Thus, the proof for the Pentium only checked half of the PLA, and assumed (incorrectly) that the other half of the PLA was simply the mirror image of what was checked (Price P. 2). Unfortunately, the untested half of the PLA contained the missing entries. The two easily discoverable flaws, one in the PLA loading script and the other in the PLA proof, conspired to hide each other from Intel engineers so that the Pentium’s flaw was not discovered until after production of the CPU began.

Events Surrounding the Flaw

Intel Corp. discovered the flaw in the Pentium’s floating point unit through testing, in June of 1994 (after production of the chip), but chose to keep the information private instead of disclosing it to their customers (Markoff). Although Intel modified the design of the Pentium, the modified chips did not begin to reach the market until November of 1994, and the sales of flawed chips were not halted. Dr. Thomas R. Nicely of Lynchburg College also independently discovered the “FDIV Bug” in June of 1994 and attempted to bring it to the attention of Intel Corp. in October of that year, whereupon an Intel representative confirmed the existence of the flaw and then ceased to provide Dr. Nicely with any more information (Nicely). Nicely then proceeded to make the Pentium floating point unit’s flaw known to the public via e-mail, causing news of the Pentium flaw to spread quickly. Concerned Pentium owners who learned of the flaw were told by Intel that the flaw was inconsequential and that no replacement policy was being offered.

12May/090

The Evils of FAT

I think we're all familar with the infamous FAT32 (File Allocation Table) file system, still in use after all these years despite the numerous superior alternatives avaliable. I myself am guilty for helping to extend FAT's unnaturally long lifetime on this earth, since in order for me to be able to have an external hard drive that is easily mountable and readable by all the major operating systems (Linux, OS X, and Windows), I had to format the disk using a commonly used file system. Unfortunately, FAT32 was the only option avaliable. It would be nice if Microsoft and Apple started including by default, drivers for some modern file system in their operating systems so that all machines could easily share external media without suffering from a performance penalty that is inherent in the file system. But this is extremely unlikely, so I won't spend too much time hoping. But what exactly is it that makes Fat such a terrible system?

Anyone using FAT32 on their external hard drive used to store media will probably be familar with FAT32's maximum file size limitation of 4GiB, which is actually larger then the maximum file size allowed in the original FAT file system. FAT also has a linear seek time within files, since in order to find the ith sector used to store data in a file, we must first find all the sectors preceding that sector. And of course, FAT has some pretty serious internal fragmentation issues, especially once we start creating and deleting files on the drive. On a physical hard drive, large internal fragmentation of files results in the hard drive head having to constantly seek around the drive in order to find the next 4KiB block. This is of course a bad thing, especially since the bottleneck on a physical hard drive is its seek time. Ideally, we would like to have continguous blocks used for a single file.

Another serious performance issue with FAT that is not readily noticeable, is the size of the File Allocation Table, and how large it grows when with the drive. Ideally, we would like to be able to just stick the whole FAT into RAM in order to improve performance, since having to cache the FAT on disk would mean we would have to do an extra read in order to read the FAT just so we could find a file on the drive. Now, lets assume that you're a movie fanatic, and in order to store your increasingly large movie collection, you've bought a new 1TB (sorry, not 1 TiB) hard drive. Of course, you want your drive to be able to function with multiple operating systems so you format it with FAT32. FAT32 uses 4KiB blocks, and each entry in the File Allocation Table takes up 4 bytes. Because we have a 1TB drive, we have about 238 entries in the table, which means that the File Allocation Table on your 1TB drive is about 1GiB. Some people might consider this to be a problem.

Of course, a fairly modern desktop computer will have 4GB of RAM so it could theoretically store the whole FAT in memory without having to cache it on disk, but I doubt that the operating system would like to dedicate a quarter of its memory to improving IO performance on one external hard disk.

So there you have, another good reason to stay away from FAT.

2Feb/092

One Reason to Buy a Mac

When people ask me why I won't buy a Mac, I generally give three reasons:

  • Too expensive -I know a lot of people will argue that the 13.3 inch Macbooks actually have a list price that is similar to a Windows Laptop, but they forget that Macbooks are never available in the bargain bin on Black Friday
  • Right click - although I have gotten a little more used to the way Mac's double click, I still don't like it that much.
  • Delete key - this is decidedly annoying, and I just don't like having to press Function+Backspace when I want to delete.

Mind you, this is just me and I won't try to push these ideas on other people, some people don't mind throwing down a few hundred extra dollars, or losing the delete key (which most people never use). But lately, I have discovered one very good reason to buy a Mac.

The day before Thanksgiving, I tripped over the power cord to my HP dv2910us. Thankfully, the laptop was wedged between piles of junk and it didn't fall off the table, but the plug was bent out of shape and the little plastic insulation on the plug's tip cracked off. Since I needed a working laptop for school, I couldn't afford to order a new power cord from ebay and wait a week for it to arrive, so instead of paying ten dollars, my dad paid fifty dollars for a new cord and brick. I know its crazy, but it had to be done. Once I had the new cord, I figured the matter was resolved and that everything was going to be hunky-dory.

Just last week,  two months after I tripped over my power cable, I woke up, plugged my laptop in, and turned it on, just like most any morning. It immediately started making a funny, high-pitched buzzing, so I switched it off. It didn't take me long to notice that the power connection port was sparking, so like any sane man would do, I unplugged the power. If you look at the poorly-taken picture to the left, you can just barely notice that the white plastic ring surrounding the port is melted on the left-hand side. As far as I can guess, my tripping over the cord probably damaged the connection port just slightly, and two months of plugging and unplugging the power cable was enough to aggravate the port's damaged condition to the point that it started shorting.

29Oct/080

Celebrating the Internet

Today I celebrate the 39th anniversary of the birth of the internet with a short blog post.

On September 29th of this year (2008), Leonard Kleinrock, a professor of computer science at UCLA received the National medal of Science at the White House for his work on the developing the basic principles of packet switching. It was because of Kleinrock's early work in packet switching, that his Network Measurement Center at UCLA was selected to be the first node on ARAPNET in 1969.

On October 29, 1969, the UCLA team sent, without any great public fanfare, the first ever host-to-host message to the Stanford Research Institute. The team meant to begin by sending the word "login" but only managed to send "log" before the network died. Nevertheless, the sending of the message was still a great success and a landmark in the development of the internet.

One would think that UCLA, or somebody, would maybe post a nice plaque commemorating what is essentially the birth of the internet. But the birthplace of the internet remains almost entirely uncelebrated. Almost.

Your brave and intrepid blogger, decided to venture out to UCLA's famous Boelter Hall to see the historic site, and found a little piece of paper tacked next to a room. It read:

1969-10-29 22:30
IN COMMEMORATION
of the first ARPANET
message, sent to the
Stanford Research
Institue from 3420
Boelter Hall.
It marks the most
evident orign of
today's internet.

And just so everyone doesn't think I'm a big fat liar, I've taken a few pictures.

Its epic cool, I know.

I bet y'all are so jealous that I got to visit the birthplace of the internet...

1Oct/081

HFS+ and Linux

In a talk that Linus Torvalds gave in February this year (2008), Torvalds claimed that Mac OS X's file system is "complete and utter crap, which is scary." That was the first time I ever heardabout Mac OS X's file system.

One of my roommates is a Mac user and is quite ignorant of almost all things technical. Recently, his hard drive crashed and he had to send his shiny Macbook Pro to a company that specialized in data recovery, and so he is currently without a computer. He does however still have a working external hard drive that contains a plethora of videos, and so yesterday I asked him if I could borrow his hard drive and look through some of his videos. He told me that I wouldn't be able to use his hard drive on my computer because one of his roommates last year, "reformatted it in a special way so that only Macs could read it."

Having read a little into Apple's file systems, after Torvald's comment earlier this year, I hypothesized that my roommate's hard drive was using Apple's HFS+ file system. Linux has surprisingly good support for various different file systems, even Microsoft's proprietary NTFS, so I knew that it was extremely likely that there existed a HFS+ driver for Linux.  So I told my roommate, "don't worry, I don't have a PC, I'll be able to read it just fine." It was a little presumptuous of me to think that I wouldn't encounter any issues with mounting a HFS+ drive, but I have great faith in the Linux community.

I plugged his hard drive into my laptop, turned it on, opened xterm and typed:

fdisk -l 

Fdisk listed his hard drive as /dev/sdb, but it also said that the drive's file system was unrecognizable, which I rather expected. A five-second Google search revealed that the modules for HFS and HFS+ are called "hfs" and "hfsplus." So I went into xterm again, and tried:

 modprobe hfsplus

mount -t  hfsplus /dev/sdb /media/hd

And the drive mounted without a problem.

According to SourceForge the hfsplus module offers full support for HFS+ file systems. So, yeah! Go Linux!

Tagged as: , , 1 Comment
12Aug/081

HP dv2910us (dv2700) – Summary and Conclusions

In short, I believe the dv2910us is a highly recommendable laptop. To the common, casual laptop user, it looks good and gets the job done and can be purchased at a surprisingly good price (the dv2911us, which lacks a Lightscribe drive, was recently on sale at Office Max for only $550 US). To the Linux user, the dv2910us manages to be pretty Linux friendly and offers solid performance with its Intel hardware, although HP probably lacks some of the geeky coolness that Lenovo has. College students will no doubt appreciate (as I do) the fact that its fairly light at five and a half pounds, has a battery life of about two and a half hours, and still manages to be pretty sturdy. Gamers however probably won't be too thrilled by the dv2910us and its integrated Intel graphics card and middle-of-the-road Intel Core 2 Duo.

The only problems I really have, is that the media keys's sensitivity is non-adjustable, and that a matte screen option (instead of glossy) isn't offered.

The dv2910us isn't anything really stellar. It doesn't have amazing processing power, super long battery, an innovative new esthetic look, a slim body, or a ridiculously low weight; which is why the dv2700 series hasn't garnered the same kind of attention as the Apple Macbook Air or the Lenovo x300. But it remains a decent laptop, nonetheless, sufficient for all but the most strenuous of tasks.

What the HP dv2910us does have to offer that all those other popular laptops lack, is an affordable price. And for many people, like me, the price is always a major determining factor.

12Aug/089

HP dv2910us (dv2700) – Installing Linux

I've decided to shorten this section down significantly, as it is probably the least significant part of this review (for most people), and for me to do it due justice would require quite a lot of time. I'm planning on writing an article later, more specifically aimed at installing Arch Linux on the dv2910us.

I was pleasantly surprised to find out that the Ubuntu Hardy Heron Live CD ran great on my dv2910us. I'm not much of an Ubuntu Fan these days, (although I don't hate it) but I couldn't help but be impressed by Hardy Heron. Everything worked great right from the Live CD, including wireless and suspend to RAM, without any tweaking required.

Last week, I finally decided to go ahead and install Arch Linux on my dv2910us. I started by just trying to use gParted to partition the drive, running from a Live CD, but after using gParted, Vista crashed and refused to boot and so I was forced to do a system restore and use Vista's tool for resizing partitions, which turned out to be pretty useless. Vista does this lovely thing where it makes a bunch of huge system restore points and pagefiles, scatters them across the disk, and doesn't bother to inform you at all about them. The only way I could even see pagefile.sys was to run the command prompt as root and then "dir /a" to list the system files. All these special system files prevent the Vista partition tool from shrinking a drive more then 10 or 20 gigs. Eventually, I was so fed up with Vista and its craptastic goodness, I was forced to retry gParted and happily enough it worked the second time!

Part of the reason that I bought the dv2910us, was because of the abundance of Intel hardware that it has. Intel tends to be a little more Linux friendly then many other companies, they open up the specifications on their hardware and write drivers for most of their equipment. Unlike my old desktop's ATI x800 xl graphics card which nearly drove me mad, the dv2910us's hardware was pretty simple to set up and use. The only thing that I haven't configured yet is the webcam, but judging by Arch Linux's wiki, it appears doable. [EDIT: August 19, 2008. I was able to get the webcam working easily enough with Skype by using the r5u870 (Ricoh) driver, and Arch Linux was able to detect the HP Webcam as a usbcam.]

The HP dv2910us probably isn't the most Linux friendly laptop around but its still quite useable; from my experience, all the hardware can be configured with relatively little fussing around. While HP doesn't have quite the reputation Lenovo does with the Linux crowd, I think HP has done a pretty good job, even if they weren't trying to.

7Aug/0850

HP dv2910us (dv2700) – User Experience

The beginning of my review of the HP dv2910us can be found here.

Despite my efforts, this review has become rather badly organized. Pretty much anything that is interesting in my review is going to be in this section.

I've heard HP referred to as "The Evil Empire," so apparently the boys and girls in HP's marketing department are trying to change their company's image by making themselves all "personal." Which is totally cool, as long as they don't expect me to cry over my lappy.

---Crapware and Such

The first time I booted up the dv2901us, I was greeted by a series of setup menus, courtesy of Microsoft, HP, and various other paid advertisers. Vista spent a surprisingly long time updating and configuring the system once I had ticked off all the required checkboxes. Its been quite a while since I've bought a pre-built computer (well actually I never have), and it was only upon first running the dv2910us that I realized just how annoying "crapware" really is. ("Crapware" is a term coined by internet writers and is used to categorize software and trial-ware that comes pre-installed on new computers.) The term is quite appropriate, as anyone who has bought a computer in the past few years will know, there are gigs of crap installed on new computers. While I was buying my new HP lappy from Circuit City, the employee who was helping me, told me that for the low, low price of $30 they would sell me a model that had had all the crapware removed by a certified Circuit City tech. While crapware is without a doubt annoying and stupid, I cannot see why the bloody hell I would want to pay someone to remove it for me when I am quite capable of doing it myself, although some people clearly are willing to pay. So I ended up spending a great deal of time removing software and advertisements from Microsoft, Yahoo, HP, Slingbox, and even Maxis (almost 3 gigs of "The Sims" trial software!), before I finally got down to really using my brand new lappy.